konstantint / SKompiler

A tool for compiling trained SKLearn models into other representations (such as SQL, Sympy or Excel formulas)
MIT License
171 stars 10 forks source link

Support XGBoost #2

Open slavaatsig opened 5 years ago

slavaatsig commented 5 years ago

Considering XGBoost is a favourite of Kaggle’s winners and widely used its support is highly wanted. Can we expect such support in a near future?

konstantint commented 5 years ago

Why not - it all boils down to taking the time to describe the model as an SK-expression. Given that SKLearn's boosting already works, it might not be too complicated.

I'm not sure I'd find the time this month, though, but pull requests are welcome any time ;)

KalinNonchev commented 1 year ago

Hello, what is the status of this? I am looking for a way to translate xgboost into excel.

konstantint commented 1 year ago

I still did not get the time to look into this. Pull requests are still welcome ;)

KalinNonchev commented 1 year ago

I looked into the code but it doesn't look so straightforward to translate. I noticed that the package also relies on some deprecated sklearn attributes.

example

[n_features_](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html#sklearn.ensemble.RandomForestClassifier.n_features_)int
DEPRECATED: Attribute n_features_ was deprecated in version 1.0 and will be removed in 1.2.

n_features_in_int
Number of features seen during [fit](https://scikit-learn.org/stable/glossary.html#term-fit).

New in version 0.24.
KalinNonchev commented 1 year ago

I implemented a small package which can translate the XGBregressor in excel format: https://github.com/KalinNonchev/xgbexcel

konstantint commented 1 year ago

Nice! xgb_model.get_booster().get_dump(dump_format='json') seems to make things really easy indeed. This should be pretty simple to implement in SKompiler as well.