I’m trying to perform training and evaluation of a classifier that has 12 classes and I’m using the C API directly. The training data input and training data labels are generated like so
XGDMatrixCreateFromMat(train_inputs, rows, cols, -1, &h_train);
XGDMatrixSetGroup(h_train, train_outputs, rows12);
where train_inputs is an array of rowscols floats and train_outputs is an array of 12*rows integers that are either 1 or 0; this is the one-hot encoding of which class that input belongs to. It’s trained, among others, with these options
XGBoosterSetParam(h_booster, “num_class”, “31”);
XGBoosterSetParam(h_booster, “objective”, “multi:softmax”);
XGBoosterSetParam(h_booster, “eval_metric”, “mlogloss”);
I perform training and this executes.
Then I try to evaluate the resulting model. I create the matrix using XGDMatrixCreateFromMat just like above. Then I use
const float *f;
XGBoosterPredict(h_booster, h_train, 0, 0, &out_len, &f);
but this crashes with a disallowed memory access.
I must be setting something wrong. Could anyone tell me or point me towards instructions on how to perform multi-class classifcation exactly? Thank you!