Skip to content
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
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
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
Prev Previous commit
Next Next commit
add explain_prediction test for regression booster
  • Loading branch information
qh582 authored May 30, 2018
commit 45379f50ebe37b929c4f6696c6a83c3b0985033e
11 changes: 11 additions & 0 deletions tests/test_lightgbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
)
from .test_sklearn_explain_prediction import (
assert_linear_regression_explained,
assert_trained_linear_regression_explained,
test_explain_prediction_pandas as _check_explain_prediction_pandas,
test_explain_clf_binary_iris as _check_binary_classifier,
)
Expand Down Expand Up @@ -193,3 +194,13 @@ def test_explain_lightgbm_booster(boston_train):
res = explain_weights(booster, feature_names=feature_names)
for expl in format_as_all(res, booster):
assert 'LSTAT' in expl

def test_explain_prediction_reg_booster(boston_train):
X, y, feature_names = boston_train
booster = lightgbm.train(
params={'objective': 'regression', 'verbose_eval': -1},
train_set=lightgbm.Dataset(X, label=y),
)
assert_trained_linear_regression_explained(
X[0], feature_names, booster, explain_prediction,
reg_has_intercept=True)