Denis  Korzhenkov
Denis Korzhenkov

Reputation: 383

Load LightGBM/XGBoost model to sklearn

LightGBM and XGBoost models can be dumped to plain text files containing human-readable model structure. In the end, they are just tree ensembles.

Is there any library to load these dumped models to the scikit-learn framework, e.g. construct sklearn ensembles with same splits and values?

That could be quiet convinient as there are some nice libraries attached to sklearn API, e.g. treeinterpreter.

Upvotes: 3

Views: 1302

Answers (1)

user2997837
user2997837

Reputation: 11

For XGBoost you can use the xgbfir library which parses the xgb model display feature interactions and ranking. Install it with:

pip install xgbfir

For lightGBM, I'm not aware of good options. Microsoft's lightGBM library allows PMML export, so perhaps you could export then use some PMML parsers.

Upvotes: 1

Related Questions