Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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-package] reorganize early stopping callback #6114
[python-package] reorganize early stopping callback #6114
Changes from 3 commits
177bd50
4af2b9a
4b988a0
bafc232
56f73b4
17fedac
bd3366a
7a98d82
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this doesn't need the env we could move it to
__init__
, WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree! Having it be a loud error right when the callback is created, instead of deferred all the way til the first iteration of training, seems useful. And I'd be surprised to learn that there are other libraries or user code depending on initializing
lgb.early_stopping()
with a negative value of this and then somehow updating the value before the first time it's called.Moved into
__init__()
in bd3366a.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doing this broke this test:
LightGBM/tests/python_package_test/test_engine.py
Lines 4502 to 4507 in f175ceb
Now the error from the early stopping callback gets thrown before this one from the C++ side:
LightGBM/src/io/config.cpp
Line 37 in f175ceb
So I pushed 7a98d82, which:
test_callback.py
on this specific error fromlgb.early_stopping()
isinstance()
check in the condition guarding that error inlgb.early_stopping()
, so you can an informative error instead of something likeTypeError: '<=' not supported between instances of 'str' and 'int'
Given all those changes, @jmoralez could you re-review? I don't want to sneak those in on your previous approval.