Hi. I implemented xgboost in c after to have saved the training in python:
int main() {
const char* modelPath = "model.json";
BoosterHandle booster;
XGBoosterCreate(NULL, 0, &booster);
int b = XGBoosterLoadModel(booster, modelPath);
printf("%d", b);
const char* test_path = "x_test.libsvm?format=libsvm";
DMatrixHandle test;
XGDMatrixCreateFromFile(test_path, 0, &test);
bst_ulong out_len;
const float* out_result;
int a = XGBoosterPredictFromDMatrix(booster, test, 0, 0,
&out_len, &out_result);
printf("%d", a);
XGDMatrixFree(test);
XGBoosterFree(booster);
}
The XGBoosterLoadModel returns 0 (ok) but XGBoosterPredictFromDMatrix gives me error. Do you know what is the problem? I saved the trained model in both the format json and bin.