-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add lightgbm.booster support #270
base: master
Are you sure you want to change the base?
Changes from 15 commits
d369977
cc5b7a4
9c2bb8e
9c31a99
a042650
72a50a2
bb19a4f
4bf2f6d
ef991cf
45379f5
a35e5c8
0bbf3e2
fa1eccd
f053399
87438d4
3c213e9
866015a
802e543
5155979
6f1ee40
0a488e3
19e9bf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -5,13 +5,13 @@ LightGBM | |||||
|
||||||
LightGBM_ is a fast Gradient Boosting framework; it provides a Python | ||||||
interface. eli5 supports :func:`eli5.explain_weights` | ||||||
and :func:`eli5.explain_prediction` for ``lightgbm.LGBMClassifer`` | ||||||
and ``lightgbm.LGBMRegressor`` estimators. | ||||||
and :func:`eli5.explain_prediction` for ``lightgbm.LGBMClassifer``, ``lightgbm.LGBMRegressor`` and ``lightgbm.Booster`` estimators. It is tested against LightGBM | ||||||
master branch. | ||||||
|
||||||
.. _LightGBM: https://github.com/Microsoft/LightGBM | ||||||
|
||||||
:func:`eli5.explain_weights` uses feature importances. Additional | ||||||
arguments for LGBMClassifier and LGBMClassifier: | ||||||
arguments for LGBMClassifier , LGBMClassifier and lightgbm.Booster: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a nitpick: extra whitespace before comma There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
* ``importance_type`` is a way to get feature importance. Possible values are: | ||||||
|
||||||
|
@@ -37,7 +37,7 @@ contribution of a feature on the decision path is how much the score changes | |||||
from parent to child. | ||||||
|
||||||
Additional :func:`eli5.explain_prediction` keyword arguments supported | ||||||
for ``lightgbm.LGBMClassifer`` and ``lightgbm.LGBMRegressor``: | ||||||
for ``lightgbm.LGBMClassifer``, ``lightgbm.LGBMRegressor`` and ``lightgbm.Booster``: | ||||||
|
||||||
* ``vec`` is a vectorizer instance used to transform | ||||||
raw features to the input of the estimator ``lgb`` | ||||||
|
@@ -50,6 +50,14 @@ for ``lightgbm.LGBMClassifer`` and ``lightgbm.LGBMRegressor``: | |||||
estimator. Set it to True if you're passing ``vec``, | ||||||
but ``doc`` is already vectorized. | ||||||
|
||||||
``lightgbm.Booster`` estimator accepts one more optional argument: | ||||||
|
||||||
* ``is_regression`` - True if solving a regression problem | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this parameter supported? It is not an argument of explain_prediction_lightgbm. |
||||||
("objective" starts with "reg") | ||||||
and False for a classification problem. | ||||||
If not set, regression is assumed for a single target estimator | ||||||
and proba will not be shown unless the ``target_names`` is defined as a list with length of two. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to contradict a note above (line 25, "target_names is ignored") - does the note about target_names apply only to classifier/regressor, but not for Booster? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for a single target estimater, booster cannot recognize wheather it is a regression problem or not. We assume it is regression in default, unless users set it as a classification problem by assigning 'target names' input [0,1] etc. Only in this case 'target names' is used. Should I remove " target names is ignored" to prevent confusion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. target names is still ignored for classifier/regressor, right? I think it makes sense to clarify it - just say that it is ignored for LGBMClassifier / LGBMRegressor, but used for lightgbm.Booster. "is defined as a list with length of two" - sohuld it be 2 elements, or 2+ is also supported? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, for single target booster, only 1+ elements target_name point booster to classification. Otherwise, this booster is regression . there is risk user assign wrong number of elements like 3, but not sure how eli5 will raise error. 2+ should not support here. |
||||||
|
||||||
.. note:: | ||||||
Top-level :func:`eli5.explain_prediction` calls are dispatched | ||||||
to :func:`eli5.xgboost.explain_prediction_lightgbm` for | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -31,7 +31,7 @@ following machine learning frameworks and packages: | |||||
of XGBClassifier, XGBRegressor and xgboost.Booster. | ||||||
|
||||||
* :ref:`library-lightgbm` - show feature importances and explain predictions | ||||||
of LGBMClassifier and LGBMRegressor. | ||||||
of LGBMClassifier , LGBMRegressor and lightgbm.Booster. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
* :ref:`library-lightning` - explain weights and predictions of lightning | ||||||
classifiers and regressors. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"It is tested against LightGBM master branch." is removed in 63e9918, sorry for the confusion. It shouldn't be re-added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, I will remove that line in next commit