Skip to content

add early stopping for hyperopt #11736

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

Merged
merged 7 commits into from
May 20, 2025
Merged

Conversation

viotemp1
Copy link
Contributor

Summary

Add early stopping for hyperopt

Quick changelog

  • Add early stopping for hyperopt

What's new?

Will shorten the hyperopt time when no improvement in Objective

Copy link
Member

@xmatthias xmatthias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, i've somehow completely missed this PR.

For the CI, you'll need to run build_helpers/create_command_partials.py and commit the result - it'll auto-update all doc descriptions to keep (at least this part of) the docs in sync with reality.

i assume in terms of testing, this is best tested with a very small search space, so it exhausts pretty quickly?

@xmatthias xmatthias added Enhancement Enhancements to the bot. Get lower priority than bugs by default. Hyperopt Hyperopt related issues and pull requests labels May 16, 2025
@coveralls
Copy link

coveralls commented May 16, 2025

Coverage Status

coverage: 94.349% (-0.01%) from 94.362%
when pulling 5a2b3d9 on viotemp1:optuna_addons
into c3f6aa1 on freqtrade:develop.

@xmatthias
Copy link
Member

xmatthias commented May 17, 2025

@viotemp1 i don't currently trust this functionality ...

with --epochs 100, --early-stop 5 - it stops after 21 epochs (same with --early-stop=2) - but the objective function is clearly still changing - significantly at that (used with --print-all to see all results)

image

@viotemp1
Copy link
Contributor Author

viotemp1 commented May 17, 2025

I looked at their source code and it should work.

The default of min_n_trials is 20 in optuna.terminator.Terminator(improvement_evaluator=None, error_evaluator=None, min_n_trials=20).
We can add a warning message when lower than 20 or change the default.

@xmatthias
Copy link
Member

well i think even enforcing a minimum of 20 (or ignoring values between 0 and 20) is reasonable.
if your result doesn't improve after 5 epochs - that won't tell you much 😆

@xmatthias xmatthias enabled auto-merge May 20, 2025 04:45
Copy link
Member

@xmatthias xmatthias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great enhancement 👍

@xmatthias xmatthias merged commit d8c2466 into freqtrade:develop May 20, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhancements to the bot. Get lower priority than bugs by default. Hyperopt Hyperopt related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants