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

Fixes the use of eval_metric in case of EarlyStoppingShapRFECV with LightGBM #261

Merged
merged 8 commits into from
Jul 4, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ def _get_fit_params_lightGBM(
"X": X_train,
"y": y_train,
"eval_set": [(X_val, y_val)],
"eval_metric": self.eval_metric,
"callbacks": [
early_stopping(self.early_stopping_rounds, first_metric_only=True),
log_evaluation(1 if self.verbose >= 2 else 0),
Expand Down Expand Up @@ -507,14 +508,6 @@ def _get_feature_shap_values_per_fold(

# Due to deprecation issues (compatibility with Sklearn) set some params
# like below, instead of through fit().
try:
from lightgbm import LGBMModel

if isinstance(model, LGBMModel):
model.set_params(eval_metric=self.eval_metric)
except ImportError:
pass

try:
from xgboost.sklearn import XGBModel

Expand Down
Loading