cerlymarco / shap-hypetune

A python package for simultaneous Hyperparameters Tuning and Features Selection for Gradient Boosting Models.
MIT License
564 stars 71 forks source link

Suppress warnings #19

Closed Rane90 closed 1 year ago

Rane90 commented 1 year ago

Hi,

While running BoostBoruta according to the notebook toturial I'm getting the following warnings which I would like to suppress:

'early_stopping_rounds' argument is deprecated and will be removed in a future release of LightGBM. Pass 'early_stopping()' callback via 'callbacks' argument instead.
'verbose' argument is deprecated and will be removed in a future release of LightGBM. Pass 'log_evaluation()' callback via 'callbacks' argument instead.

Any ideas on how to do that?

Thank you

cerlymarco commented 1 year ago

Hi, thanks for your interest. Since this warning is proper to LightGBM and has nothing to do with shap-hypetune, you can easily find "solutions" on the net...

if u support the project, don't forget to leave a star ;-)

Rane90 commented 1 year ago

Thank you for your response.

I should have provided more details:

  1. I do not use these parameters (see my params dict below)
  2. Combining item 1 with the fact that shap-hypetune calls the lighgbm fit/train function: I see this warning as in the scope of shap-hyptune.
  3. I could not easily find any "solutions" on the net. That is why I wrote this issue.
params = {'objective': 'binary',
            'random_state': RANDOM_STATE_INTEGER_GLOBAL,
            'metric': 'auc',
            'is_unbalance': True
            }

lgbm = lgb.LGBMClassifier(**params)

model = BoostBoruta(
    lgbm, max_iter=200, perc=50,
    importance_type='shap_importances', train_importance=False, alpha=0.01,
)
model.fit(X_train, y_train, eval_set=[
          (X_val, y_val)], early_stopping_rounds=6, verbose=0)
cerlymarco commented 1 year ago

you are using early_stopping_rounds in fit. fit simply call lgbm fit under the hood. use callbacks=[lgb.early_stopping(6)] instead of early_stopping_rounds as stated on the links provided.

All the best

Rane90 commented 1 year ago

Thank you :)

The correct call is:

callbacks=[lgb.early_stopping(stopping_rounds=6)]