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

EarlyStopping instance is not reusable #20521

Closed
maciejbiesek opened this issue Nov 19, 2024 · 1 comment · Fixed by #20533
Closed

EarlyStopping instance is not reusable #20521

maciejbiesek opened this issue Nov 19, 2024 · 1 comment · Fixed by #20533
Assignees

Comments

@maciejbiesek
Copy link

From my observations it seems that we cannot use the same instance of EarlyStopping callback when training multiple models. My assumption is that it saves the best value from one training and uses it to compare during the training of the next model.

In on_train_begin we have comment "# Allow instances to be re-used", however the value self.best is not cleared. I think it should be reinitialized with self.best = (float("inf") if self.monitor_op == ops.less else -float("inf")) as in __init__().

@sachinprasadhs sachinprasadhs added the keras-team-review-pending Pending review by a Keras team member. label Nov 20, 2024
@hertschuh hertschuh self-assigned this Nov 22, 2024
@hertschuh hertschuh removed the keras-team-review-pending Pending review by a Keras team member. label Nov 22, 2024
hertschuh added a commit to hertschuh/keras that referenced this issue Nov 22, 2024
All values were already reset properly in `on_train_begin` except `best`.

Fixes keras-team#20521
fchollet pushed a commit that referenced this issue Nov 22, 2024
All values were already reset properly in `on_train_begin` except `best`.

Fixes #20521
@hertschuh
Copy link
Collaborator

@maciejbiesek ,

Thank you for the report. The fix is in and should be in the keras-nightly pip package tomorrow.

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

Successfully merging a pull request may close this issue.

3 participants