Add fitness standard deviation restart condition#103
Open
githubpsyche wants to merge 1 commit intoRobertTLange:mainfrom
Open
Add fitness standard deviation restart condition#103githubpsyche wants to merge 1 commit intoRobertTLange:mainfrom
githubpsyche wants to merge 1 commit intoRobertTLange:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Thanks for maintaining
evosax!SciPy's
differential_evolutionsupports early stopping based on the standard deviation of the current population fitness values:This lets callers set a conservative maximum generation budget while still allowing easier runs to exit once the population has converged in objective value. I've found this same stopping rule useful for performance in my own work with
evosax.evosaxalready has restart-condition utilities inevosax.core.restart, and users often compose their ownask/tellloops. I thought this rule fit naturally as another small reusable predicate in that module, so this PR addsFitnessStdRestartParams(tol=0.001, atol=0.0)andfitness_std_cond(...).The predicate returns
Falseif any fitness value is non-finite; otherwise it applies theatol + tol * abs(mean(fitness))threshold. I kept this intentionally narrow: no runner abstraction and no algorithm API changes. Let me know if you would prefer a different name or location for this utility.I added restart tests for tolerance behavior, non-finite fitness values, and JIT compatibility. ruff and the full pytest tests/ suite pass locally.