-
-
Notifications
You must be signed in to change notification settings - Fork 619
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
add NoImprovementHandler #2574
base: master
Are you sure you want to change the base?
add NoImprovementHandler #2574
Conversation
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.
Thanks for the PR @Ishan-Kumar2 !
I left few minor comments to address.
self.trainer = trainer | ||
self.counter = 0 | ||
self.best_score = None # type: Optional[float] | ||
self.logger = setup_logger(__name__ + "." + self.__class__.__name__) |
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.
We may want also the logger for NoImprovementHandler
?
""" | ||
|
||
_state_dict_all_req_keys = ( |
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.
If we want to save NoImprovementHandler's internal state we have to keep _state_dict_all_req_keys
, IMO
@Ishan-Kumar2 It looks very good, thanks ! Please go ahead with the tests ! |
@sdesrozis @vfdev-5 I have added the tests, a lot of them are similar to the EarlyStopping tests and might not be even needed since they both use the NoImprovementHandler functions. For instance, Also, the failing test seems unrelated to this PR |
Yes please, removing redundancy would be great. Let's see on our side to fix unrelated issues before merging. Thanks again and sorry for the late answer. |
@sdesrozis I was thinking about the redundancies, while it's true that they both call the same function do you think it is still worth having retaining the |
@Ishan-Kumar2 the tests are both useful especially if we consider the evolution of the library. I was thinking about having an unique and generic test code for the both. It would imply introducing an abstraction for the test result. As the tests are quite small and clear, I'm finally not sure about that. So let's keep it simple. I will review asap. Thanks again. |
Fixes #2314
Description:
As described in the issue, added a generalized version of EarlyStopping where the
stop_function
andpass_function
can be user-defined.@sdesrozis let me know if the approach is correct, I'll start working on the tests.
Check list: