Skip to content

Commit 14cfdb1

Browse files
committed
add back INITIAL_POINTS (default 30) for Samplers which support this
1 parent dfae7ca commit 14cfdb1

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

freqtrade/optimize/hyperopt/hyperopt_optimizer.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
logger = logging.getLogger(__name__)
4747

48+
INITIAL_POINTS = 30
4849

4950
MAX_LOSS = 100000 # just a big enough number to be bad result in loss optimization
5051

@@ -425,7 +426,16 @@ def get_optimizer(
425426
raise OperationalException(f"Optuna Sampler {o_sampler} not supported.")
426427
with warnings.catch_warnings():
427428
warnings.filterwarnings(action="ignore", category=ExperimentalWarning)
428-
sampler = optuna_samplers_dict[o_sampler](seed=random_state)
429+
if o_sampler in ["NSGAIIISampler", "NSGAIISampler"]:
430+
sampler = optuna_samplers_dict[o_sampler](
431+
seed=random_state, population_size=INITIAL_POINTS
432+
)
433+
elif o_sampler in ["GPSampler", "TPESampler", "CmaEsSampler"]:
434+
sampler = optuna_samplers_dict[o_sampler](
435+
seed=random_state, n_startup_trials=INITIAL_POINTS
436+
)
437+
else:
438+
sampler = optuna_samplers_dict[o_sampler](seed=random_state)
429439
else:
430440
sampler = o_sampler
431441

0 commit comments

Comments
 (0)