-
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
Open
qh582
wants to merge
22
commits into
TeamHG-Memex:master
Choose a base branch
from
qh582:qh582-lightgbm-booster
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
d369977
add lightgbm.booster support
qh582 cc5b7a4
Merge pull request #1 from qh582/qh582-lightgbm-booster
qh582 9c2bb8e
fix bug
qh582 9c31a99
bug fix
qh582 a042650
fix build for typing
qh582 72a50a2
add _check_booster_args test
qh582 bb19a4f
add explain_weights test for booster
qh582 4bf2f6d
Merge pull request #2 from qh582/qh582-lightgbm-booster
qh582 ef991cf
correct is_regression
qh582 45379f5
add explain_prediction test for regression booster
qh582 a35e5c8
Merge pull request #3 from qh582/qh582-test
qh582 0bbf3e2
add booster multiclass test
qh582 fa1eccd
fix booster binary case
qh582 f053399
add test_explain_prediction_booster_binary
qh582 87438d4
remove redundant code
qh582 3c213e9
add _lgb_n_targets test
qh582 866015a
Merge pull request #4 from qh582/qh582-lightgbm-booster
qh582 802e543
Update docs
qh582 5155979
update docs
qh582 6f1ee40
Merge branch 'master' into qh582-lightgbm-booster
qh582 0a488e3
update booster is_regression
qh582 19e9bf3
Merge branch 'master' into qh582-lightgbm-booster
qh582 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update booster is_regression
- Loading branch information
commit 0a488e391baf93b3030768a1c976793e271706e6
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,7 @@ 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``, ``lightgbm.LGBMRegressor`` and ``lightgbm.Booster`` estimators. It is tested against LightGBM | ||
master branch. | ||
and :func:`eli5.explain_prediction` for ``lightgbm.LGBMClassifer``, ``lightgbm.LGBMRegressor`` and ``lightgbm.Booster`` estimators. | ||
|
||
.. _LightGBM: https://github.com/Microsoft/LightGBM | ||
|
||
|
@@ -22,7 +21,7 @@ arguments for LGBMClassifier , LGBMClassifier and lightgbm.Booster: | |
- 'weight' - the same as 'split', for better compatibility with | ||
:ref:`library-xgboost`. | ||
|
||
``target_names`` and ``target`` arguments are ignored. | ||
``target_names`` arguement is ignored for ``lightgbm.LGBMClassifer`` / ``lightgbm.LGBMRegressor``, but used for ``lightgbm.Booster``. ``target`` argument is ignored. | ||
|
||
.. note:: | ||
Top-level :func:`eli5.explain_weights` calls are dispatched | ||
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. I think lightgbm.Booster should be mentioned here as well. |
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -38,7 +38,9 @@ def explain_weights_lightgbm(lgb, | |||||
``top``, ``feature_names``, | ||||||
``feature_re`` and ``feature_filter`` parameters. | ||||||
|
||||||
``target_names`` and ``targets`` parameters are ignored. | ||||||
``target_names`` arguement is ignored for ``lightgbm.LGBMClassifer`` / ``lightgbm.LGBMRegressor``, | ||||||
but used for ``lightgbm.Booster``. | ||||||
``target`` argument is ignored. | ||||||
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
|
||||||
|
||||||
Parameters | ||||||
---------- | ||||||
|
@@ -123,12 +125,13 @@ def explain_prediction_lightgbm( | |||||
prediction = lgb.predict(X) | ||||||
n_targets = prediction.shape[-1] | ||||||
if is_regression is None and target_names is None: | ||||||
# When n_targets is 1, this can be classification too, | ||||||
# but it's safer to assume regression. | ||||||
# When n_targets is 1, this can be classification too. | ||||||
# It's safer to assume regression in this case, | ||||||
# unless users set it as a classification problem by assigning 'target_names' input [0,1] etc. | ||||||
# If n_targets > 1, it must be classification. | ||||||
is_regression = n_targets == 1 | ||||||
elif is_regression is None: | ||||||
is_regression = len(target_names) == 1 | ||||||
is_regression = len(target_names) == 1 and n_targets == 1 | ||||||
|
||||||
if is_regression: | ||||||
proba = None | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.