Class or Function Names DEHBSampler DEHBPruner Installation There is no additional installation required for this sampler and pruner, but if you want to run the example.py script, you need to install the following packages:
$ pip install sklearn Example sampler = DEHBSampler() pruner = DEHBPruner(min_resource=1, max_resource=n_train_iter, reduction_factor=3) study = optuna.create_study(sampler=sampler, pruner=pruner) See example.py for a full example. The following figures are obtained from the analysis of the optimization. Others References Awad, N.
Class or Function Names HyperbandPruner Example study = optuna.create_study( direction="maximize", pruner=optuna.pruners.HyperbandPruner( min_resource=1, max_resource=n_train_iter, reduction_factor=3 ), ) study.optimize(objective, n_trials=20) See example.py for a full example.
Others See the documentation for more details.
Class or Function Names MedianPruner Example import optuna from optuna.pruners import MedianPruner def objective(trial): s = 0 for step in range(20): x = trial.suggest_float(f"x_{step}", -5, 5) s += x**2 trial.report(s, step) if trial.should_prune(): raise optuna.TrialPruned() return s pruner = MedianPruner() study = optuna.create_study(pruner=pruner) study.optimize(objective, n_trials=20) Others See the documentation for more details.
Class or Function Names NopPruner Example study = optuna.create_study(direction="maximize", pruner=optuna.pruners.NopPruner()) study.optimize(objective, n_trials=20) See example.py for a full example.
Others See the documentation for more details.
Class or Function Names PatientPruner Example study = optuna.create_study( direction="maximize", pruner=optuna.pruners.PatientPruner(optuna.pruners.MedianPruner(), patience=1), ) study.optimize(objective, n_trials=20) See example.py for a full example.
Others See the documentation for more details.
Class or Function Names PercentilePruner Example import optuna from optuna.pruners import PercentilePruner def objective(trial): s = 0 for step in range(20): x = trial.suggest_float(f"x_{step}", -5, 5) s += x**2 trial.report(s, step) if trial.should_prune(): raise optuna.TrialPruned() return s pruner = PercentilePruner(25.0) study = optuna.create_study(pruner=pruner) study.optimize(objective, n_trials=20) Others See the documentation for more details.
Class or Function Names SuccessiveHalvingPruner Example study = optuna.create_study( direction="maximize", pruner=optuna.pruners.SuccessiveHalvingPruner() ) study.optimize(objective, n_trials=20) See example.py for a full example.
Others See the documentation for more details.
Class or Function Names ThresholdPruner Example study = create_study(pruner=ThresholdPruner(upper=1.0)) study.optimize(objective_for_upper, n_trials=10) study = create_study(pruner=ThresholdPruner(lower=0.0)) study.optimize(objective_for_lower, n_trials=10) See example.py for a full example.
Others See the documentation for more details.
Class or Function Names WilcoxonPruner Example study = optuna.create_study(pruner=optuna.pruners.WilcoxonPruner(p_threshold=0.1)) study.optimize(objective, n_trials=100) See example.py for a full example.
Others See the documentation for more details.