TeamHG-Memex / eli5

A library for debugging/inspecting machine learning classifiers and explaining their predictions
http://eli5.readthedocs.io
MIT License
2.75k stars 331 forks source link

no support for LGBMRegressor #280

Closed buus2 closed 5 years ago

buus2 commented 5 years ago

Hi, Although LightGBM is officially supported, in a Jupyter notebook for

lgb_model = lgb.LGBMRegressor()
lgb_model.fit(X, Y)
eli5.explain_weights(lgb_model)

I obtain

Error: estimator LGBMRegressor(boosting_type='gbdt', class_weight=None, colsample_bytree=1.0,
importance_type='split', learning_rate=0.1, max_depth=-1, min_child_samples=20,
min_child_weight=0.001, min_split_gain=0.0, n_estimators=100, n_jobs=-1, num_leaves=31,
objective=None, random_state=12, reg_alpha=0.0, reg_lambda=0.0, silent=True, subsample=1.0,
subsample_for_bin=200000, subsample_freq=0) is not supported

I use LightGBM 2.2.1, eli5 0.8. @lopuhin What to do?

buus2 commented 5 years ago

@kmike @lopuhin Friendly reminder about the issue I posted.

lopuhin commented 5 years ago

@buus2 at first I thought that this due to missing support for lightgmb booster (which is being fixed in https://github.com/TeamHG-Memex/eli5/pull/270), but now I see that you are using scikit-learn API and this should work (and is tested on Travis), it is supported here:

https://github.com/TeamHG-Memex/eli5/blob/7218e0da76cd952d768cdec0986b24eaeaaabb3e/eli5/lightgbm.py#L22

So I'm not sure how can it happen so far... I checked Travis build and it's using exactly the same version lightgbm==2.2.1: https://travis-ci.org/TeamHG-Memex/eli5/jobs/451009709#L770 and here is the test: https://github.com/TeamHG-Memex/eli5/blob/7218e0da76cd952d768cdec0986b24eaeaaabb3e/tests/test_lightgbm.py#L50-L52

Which python version do you use?

buus2 commented 5 years ago

I have just tried again and this time it worked perfectly… My current setup is: Ubuntu 18.04 Python 3.6.6 JupyterLab 0.34.8 LightGBM 2.2.1 eli5 0.8 The apt logs say that during last 3 weeks (after 2018-10-26) I updated Ubuntu and Python: https://pastebin.com/hVdSAjt7 JupyterLab, LightGBM and eli5 are the same like they were when I opened this thread.

Anyway, since now it works, I think we may close this discussion. Sorry for bothering you and thank you for the nice tool you provide.

lopuhin commented 5 years ago

Thanks for persistence and for your kind words @buus2 ! 👍 Closing this.