Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ It provides support for the following machine learning frameworks and packages:
XGBRegressor and xgboost.Booster.

* LightGBM_ - show feature importances and explain predictions of
LGBMClassifier and LGBMRegressor.
LGBMClassifier, LGBMRegressor and lightgbm.Booster.

* lightning_ - explain weights and predictions of lightning classifiers and
regressors.
Expand Down
15 changes: 11 additions & 4 deletions docs/source/libraries/lightgbm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +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. It is tested against LightGBM
and :func:`eli5.explain_prediction` for ``lightgbm.LGBMClassifer``, ``lightgbm.LGBMRegressor`` and ``lightgbm.Booster`` estimators. It is tested against LightGBM
master branch.
Copy link
Contributor

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.

Copy link
Author

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


.. _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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a nitpick: extra whitespace before comma

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arguments for LGBMClassifier , LGBMClassifier and lightgbm.Booster:
arguments for LGBMClassifier, LGBMClassifier and lightgbm.Booster:


* ``importance_type`` is a way to get feature importance. Possible values are:

Expand All @@ -38,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``
Expand All @@ -51,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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Author

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Author

@qh582 qh582 May 31, 2018

Choose a reason for hiding this comment

The 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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
of LGBMClassifier , LGBMRegressor and lightgbm.Booster.
of LGBMClassifier, LGBMRegressor and lightgbm.Booster.


* :ref:`library-lightning` - explain weights and predictions of lightning
classifiers and regressors.
Expand Down