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

[python] reset storage in record evaluation callback each time before starting training #4885

Merged
merged 5 commits into from
Dec 18, 2021

Conversation

StrikerRUS
Copy link
Collaborator

@StrikerRUS StrikerRUS commented Dec 12, 2021

Similarly to #4868.

Also, simplify early stopping callback by unconditionally reset all storages at the first iteration. This is much easier than tracking inited nonlocal flag (refer to #4868 (comment)).

@StrikerRUS StrikerRUS added the fix label Dec 12, 2021
@@ -319,6 +322,7 @@ def test_grid_search():
assert grid.best_estimator_.best_score_['valid_0']['error'] == 0
assert score >= 0.2
assert score <= 1.
assert evals_result == grid.best_estimator_.evals_result_
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assert fails at master:

>       assert evals_result == grid.best_estimator_.evals_result_
E       AssertionError: assert {'valid_0': O..., 0, 0, 0])])} == {'valid_0': O... [0, 0, 0])])}
E         Differing items:
E         {'valid_0': OrderedDict([('multi_logloss', [0.5915701709051111, 0.5814219901209461, 0.6047065388140261, 0.555159764382..., 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])])} != {'valid_0': OrderedDict([('multi_logloss', [0.11975431959688579, 0.11424123104047454, 0.11872456319439122]), ('error', [0, 0, 0])])}

https://github.com/microsoft/LightGBM/runs/4499752025?check_suite_focus=true#step:3:834

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me!

@StrikerRUS StrikerRUS merged commit 8e729af into master Dec 18, 2021
@StrikerRUS StrikerRUS deleted the record_callback branch December 18, 2021 14:30
@StrikerRUS StrikerRUS mentioned this pull request Jan 6, 2022
13 tasks
@jameslamb jameslamb mentioned this pull request Oct 7, 2022
40 tasks
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants