I am a newbie at integrating external ML libraries into TMVA. I trained a xgboost model with the sklearn wrapper and saved it:
bst = XGBClassifier(...)
bst.fit(X_train, y_train, sample_weight=weight_train_balanced) #(x and y are pandas dataframes with float or integer values in them)
ROOT.TMVA.Experimental.SaveXGBoost(bst, "XGB", "location/XGBtest.root", num_inputs=len(X_train.columns))
for SaveXGBoost to work I renamed the columns of my dataframes to f1,f2,… as would happen in native xgboost.
I can then acces it in my c++ framework via:
TMVA::Experimental::RBDT<> bdt("myBDT", "location/XGBtest.root");
varmap["_eventBDT"] = bdt.Compute(featurevec);
I however can’t figure out what input the Compute function of this bdt wants to recieve to give a prediction for one event. I followed the ROOT TMVA tmva103__Application_8C tutorial (as a new user I can’t post links), which indicates an ordered vector of the input variables is the way to go.
But this results in the following error (it seems to want one double…):
error: cannot convert ‘std::vector<float, std::allocator >’ to ‘std::map<std::__cxx11::basic_string, double>::mapped_type’ {aka ‘double’}
A map between "fi"s to its values doesn’t work either. Any ideas what input format would make my little bdt happy?