Is there a way to create a custom early stopping criterion? #44
-
Hello all! I am so glad that this package exists and thus far have had a great experience with it. For context: I am using the HillClimbingOptimizer to test an explanation method for research. In this particular case, I am working with a binary classification problem where every point has a true label of belonging to either the positive class or the negative class. The results of the optimization return parameters defining a set. For the positive class, this set is always non-empty and I have no issues using the stopping criterion of n_iter_no_change. For the negative class, however, it should be an empty set. Because of the way the parameters are set up. This would be indicated by only one of the parameters needing to be returned as 0. Is there a way for me to create a custom stopping criterion like n_iter_no_change but for only one or two of the parameter results? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hello @erussell92, I am glad you had a great experience with this package. Let's see if I can make it better. Making the So the return of the objective-function in GFO is either non-empty (positive) or empty (negative), right? And if the negative case gets returned multiple times in a row the early_stopping gets triggered, because there is no apparent change in the "score". Is this the problem, that you described? If there are further explanations needed, maybe you could write some simple pseudo-code to explain: ...
def objective_function(opt):
...
return positive class / negative class
... |
Beta Was this translation helpful? Give feedback.
Thank you for this detailed explanation! It is nice to see such an interesting use-case.
So this problem is interesting, because you want to enable early-stopping by the condition of the parameters (but normally the condition is the score). And if I understood this correctly you could already solve this with some conditions in the objective-function:
With this 'hack' that score gets automatically set to the worst possible value (GFO can handle inf/nan) if 'h' or 'w' are 0. So if we have the negat…