0

My study is setup to use the Hyperband pruner with 60 trials, 10M max resource and reduction factor of 2.


def optimize_agent(trial):
    # ...
    model = PPO("MlpPolicy", env, **params)
    model.learn(total_timesteps=2000000)


study = optuna.create_study(
    direction="maximize",
    pruner=optuna.pruners.HyperbandPruner(
        min_resource=1, max_resource=10000000, reduction_factor=2
    ),
)
study.optimize(optimize_agent, n_trials=60, n_jobs=2)

When I let the study run overnight, it ran the first 6 trials to completion (2M steps each). Isn't the HyberbandPruner supposed to stop at least some trials before they complete?

gameveloster
  • 901
  • 1
  • 6
  • 18

1 Answers1

0

Probably, you already have found the answer, but in your learn Method should be the 3 lines of code reporting the intermediate value.

# some_value is some kind of intermediate value you want to track
trial.report(some_value, step)

if trial.should_prune():
  raise optuna.TrialPruned()