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

Clarification on Early Stopping Behavior with Multiple eval_set in LightGBM #6475

Closed
JuseTiZ opened this issue Jun 10, 2024 · 2 comments
Closed
Labels

Comments

@JuseTiZ
Copy link

JuseTiZ commented Jun 10, 2024

Hello LightGBM Team,

I have a question regarding the early stopping mechanism when multiple evaluation datasets (eval_set) are specified in the fit method.

Example Code:

callbacks = [early_stopping(stopping_rounds=75)]
light.fit(
    X_train,
    y_train,
    eval_names=['valid1', 'valid2'],
    eval_set=[(X_valid1, y_valid1), (X_valid2, y_valid2)],
    callbacks=callbacks
)

Documentation:

Requires at least one validation data and one metric. If there’s more than one, will check all of them. But the training data is ignored anyway.
https://lightgbm.readthedocs.io/en/latest/pythonapi/lightgbm.early_stopping.html

I have a question regarding the phrase "check all of them" in the context of LightGBM's early stopping. Does this mean that LightGBM merges the evaluation datasets and makes a decision based on the combined performance? Or does it monitor each dataset individually and trigger early stopping if any one of them shows no improvement?

@jameslamb
Copy link
Collaborator

Thanks for using LightGBM.

In the Python package, each evaluation dataset is monitored individually, and early stopping can be triggered based on any one of them. You may want to subscribe to notifications #6424 and #6360 to keep up with potential changes to allow finer control of that behavior.

@JuseTiZ
Copy link
Author

JuseTiZ commented Jun 10, 2024

Clear explanation, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants