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

EarlyStoppingCallback minimize and maximize #4

Open
etfrer-yi opened this issue Oct 26, 2024 · 0 comments
Open

EarlyStoppingCallback minimize and maximize #4

etfrer-yi opened this issue Oct 26, 2024 · 0 comments

Comments

@etfrer-yi
Copy link

etfrer-yi commented Oct 26, 2024

In https://github.com/shlienlab/raccoon/blob/3a3a9e3f20819f9bfd8b739425f5812de66339f6/raccoon/optim/tpe.py#L68C7-L68C28, there is a class EarlyStoppingCallback. In the comments, it is mentioned that the direction can be ""minimize" or "minimize", which clearly omits the "maximize" case.

In the code itself, lines 86-93, we have

        if direction == "minimize":
            self._operator = operator.lt
            self.tolerance = -tolerance
            self._score = inf
        elif direction == "minimize":
            self._operator = operator.gt
            self.tolerance = tolerance
            self._score = -inf

I believe that the second if statement should be "maximize" instead.

To be fair, the code itself does not seem to be affected, since the only place where EarlyStoppingCallback is used is in a single statement within the same file,

early_stopping = EarlyStoppingCallback(patience=patience, tolerance=tol, 
                                           direction="minimize")

so the impact isn't really huge unless other users are also create EarlyStoppingCallback instances.

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

No branches or pull requests

1 participant