Converting .bin format model to .xml or .root format

Dear Experts,

I have already trained models with xgboost package in binary format( .bin) and I want to convert it to root or xml format in order to be used to evaluate in TMVA. Is there any convertor or an example of how to convert it?

Thanks a lot


Adding @lmoneta in the loop.


I also find this instruction from

import ROOT
import xgboost as xgb
ele =xgb.Booster()
ROOT.TMVA.SaveXGBoost(ele, “myBDT”, “model.root”)

But it seems the last command is not working and giving the following error

Traceback (most recent call last):
File “”, line 1, in
AttributeError: <namespace cppyy.gbl.TMVA at 0x12f8fea60> has no attribute ‘SaveXGBoost’. Full details:
type object ‘TMVA’ has no attribute ‘SaveXGBoost’
‘TMVA::SaveXGBoost’ is not a known C++ class
‘SaveXGBoost’ is not a known C++ template
‘SaveXGBoost’ is not a known C++ enum

Is SaveXGBoost already implemented or this is something under development?


It is already implemented, but currently doesn’t work well.

It will be fixed in the upcoming ROOT 6.32.00 by replacing the internals with the FastForest library.


Just to add to the post above, which I fully support: 6.32.00 is due at the end of the month. For the moment only the Release Candidate is available.