Skip to content

Commit

Permalink
Merge pull request #689 from lijm1358/optuna-fix
Browse files Browse the repository at this point in the history
Fix the issue of Optuna tuning mode with LightGBM
  • Loading branch information
pplonski authored Jan 8, 2024
2 parents 8678d84 + 80bc095 commit 17af68b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions supervised/tuner/optuna/lightgbm.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,17 @@ def __call__(self, trial):
pruning_callback = optuna.integration.LightGBMPruningCallback(
trial, metric_name, "validation"
)
early_stopping_callback = lgb.early_stopping(
self.early_stopping_rounds, verbose=False
)

gbm = lgb.train(
param,
self.dtrain,
valid_sets=[self.dvalid],
valid_names=["validation"],
verbose_eval=False,
callbacks=[pruning_callback],
callbacks=[pruning_callback, early_stopping_callback],
num_boost_round=self.rounds,
early_stopping_rounds=self.early_stopping_rounds,
feval=self.custom_eval_metric,
)

Expand Down

0 comments on commit 17af68b

Please sign in to comment.