Skip to content

Commit 28e5efc

Browse files
committed
fix docs
1 parent 5b92af6 commit 28e5efc

File tree

6 files changed

+8
-6
lines changed

6 files changed

+8
-6
lines changed

docs/commands/hyperopt.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ usage: freqtrade hyperopt [-h] [-v] [--no-color] [--logfile FILE] [-V]
1616
[--random-state INT] [--min-trades INT]
1717
[--hyperopt-loss NAME] [--disable-param-export]
1818
[--ignore-missing-spaces] [--analyze-per-epoch]
19+
[--early-stop INT]
1920
2021
options:
2122
-h, --help show this help message and exit
@@ -87,6 +88,8 @@ options:
8788
Suppress errors for any requested Hyperopt spaces that
8889
do not contain any parameters.
8990
--analyze-per-epoch Run populate_indicators once per epoch.
91+
--early-stop INT Early stop hyperopt if no improvement after (default:
92+
0) epochs.
9093
9194
Common arguments:
9295
-v, --verbose Verbose mode (-vv for more, -vvv to get all messages).

docs/hyperopt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ freqtrade hyperopt --config config.json --hyperopt-loss <hyperoptlossname> --str
490490
```
491491

492492
The `-e` option will set how many evaluations hyperopt will do. Since hyperopt uses Bayesian search, running too many epochs at once may not produce greater results. Experience has shown that best results are usually not improving much after 500-1000 epochs.
493-
The `-es` option will set after how many epochs with no improvements hyperopt will stop. A good value is 20-30% of the total epochs. Early stop is by default disabled (`-es=0`)
493+
The `--early-stop` option will set after how many epochs with no improvements hyperopt will stop. A good value is 20-30% of the total epochs. Early stop is by default disabled (`--early-stop=0`)
494494

495495
Doing multiple runs (executions) with a few 1000 epochs and different random state will most likely produce different results.
496496

freqtrade/commands/cli_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ def __init__(self, *args, **kwargs):
263263
default=constants.HYPEROPT_EPOCH,
264264
),
265265
"early_stop": Arg(
266-
"-es",
267266
"--early-stop",
268267
help="Early stop hyperopt if no improvement after (default: %(default)d) epochs.",
269268
type=check_int_positive,

freqtrade/configuration/configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ def _process_optimize_options(self, config: Config) -> None:
335335
]
336336
self._args_to_config_loop(config, configurations)
337337
if self.args.get("early_stop", 0) > 0:
338+
config.update({"early_stop": self.args["early_stop"]})
338339
logger.info(
339340
f"Parameter --early-stop detected ... Will early stop hyperopt if no improvement "
340341
f"after {self.args.get('early_stop')} epochs ..."

freqtrade/optimize/hyperopt/hyperopt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def start(self) -> None:
318318
gc.collect()
319319

320320
if (
321-
self.hyperopter.es_batches > 0
321+
self.hyperopter.es_epochs > 0
322322
and self.hyperopter.es_terminator.should_terminate(self.opt)
323323
):
324324
logger.info(f"Early stopping after {(i + 1) * jobs} epochs")

freqtrade/optimize/hyperopt/hyperopt_optimizer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def __init__(self, config: Config, data_pickle_file: Path) -> None:
106106
self.market_change = 0.0
107107

108108
self.es_epochs = config.get("early_stop", 0)
109-
self.es_batches = self.es_epochs // config.get("hyperopt_jobs", 1)
110109
if self.es_epochs > 0 and self.es_epochs < 0.2 * config.get("epochs", 0):
111110
logger.warning(f"Early stop epochs {self.es_epochs} lower than 20% of total epochs")
112111

@@ -430,10 +429,10 @@ def get_optimizer(
430429
else:
431430
sampler = o_sampler
432431

433-
if self.es_batches > 0:
432+
if self.es_epochs > 0:
434433
with warnings.catch_warnings():
435434
warnings.filterwarnings(action="ignore", category=ExperimentalWarning)
436-
self.es_terminator = Terminator(BestValueStagnationEvaluator(self.es_batches))
435+
self.es_terminator = Terminator(BestValueStagnationEvaluator(self.es_epochs))
437436

438437
logger.info(f"Using optuna sampler {o_sampler}.")
439438
return optuna.create_study(sampler=sampler, direction="minimize")

0 commit comments

Comments
 (0)