Namespace OptunaSharp.Pruners
Classes
- BasePruner
Base class for pruners. Port of
optuna/pruners/_base.py: BasePruner.
- HyperbandPruner
Pruner using Hyperband. Port of
optuna/pruners/_hyperband.py: HyperbandPruner.As SuccessiveHalving (SHA) requires the number of configurations
nas its hyperparameter, for a given finite budgetBall the configurations have the resources ofB/non average. Hyperband attacks this trade-off by trying differentnvalues for a fixed budget. Hyperband runs multiple SuccessiveHalvingPruners ("brackets"); the number of brackets isfloor(log_eta(maxResource/minResource)) + 1.HyperbandPrunercomputes the bracket ID for each trial fromstudy_nameand the trial number (CRC-32), so specifystudyNameto make the pruning algorithm reproducible.
- MedianPruner
Pruner using the median stopping rule. Port of
optuna/pruners/_median.py: MedianPruner.Prune if the trial's best intermediate result is worse than median of intermediate results of previous trials at the same step. It stops unpromising trials early based on the intermediate results compared against the median of previous completed trials.
The pruner handles NaN values in the following manner:
- If all intermediate values of the current trial are NaN, the trial will be pruned.
- During the median calculation across completed trials, NaN values are ignored. Only valid numeric values are considered.
- NopPruner
Pruner which never prunes trials. Port of
optuna/pruners/_nop.py: NopPruner.
- PatientPruner
Pruner which wraps another pruner with tolerance. Port of
optuna/pruners/_patient.py: PatientPruner(experimental since 2.8.0).This pruner monitors intermediate values in a trial and prunes the trial if the improvement in the intermediate values after a patience period is less than a threshold.
The pruner handles NaN values in the following manner:
- If all intermediate values before or during the patient period are NaN, the trial will not be pruned.
- During the pruning calculations, NaN values are ignored. Only valid numeric values are considered.
- PercentilePruner
Pruner to keep the specified percentile of the trials. Port of
optuna/pruners/_percentile.py: PercentilePruner.Prune if the best intermediate value is in the bottom percentile among trials at the same step.
- SuccessiveHalvingPruner
Pruner using Asynchronous Successive Halving Algorithm. Port of
optuna/pruners/_successive_halving.py: SuccessiveHalvingPruner.Successive Halving is a bandit-based algorithm to identify the best one among multiple configurations. This class implements an asynchronous version of Successive Halving (ASHA).
Note that this class does not take care of the parameter for the maximum resource, referred to as R in the paper. The maximum resource allocated to a trial is typically limited inside the objective function.
- ThresholdPruner
Pruner to detect outlying metrics of the trials. Port of
optuna/pruners/_threshold.py: ThresholdPruner.Prune if a metric exceeds upper threshold, falls behind lower threshold or reaches
NaN.
- WilcoxonPruner
Pruner based on the Wilcoxon signed-rank test. Port of
optuna/pruners/_wilcoxon.py: WilcoxonPruner(experimental since 3.6.0).This pruner performs the Wilcoxon signed-rank test between the current trial and the current best trial, and stops whenever the pruner is sure up to a given p-value that the current trial is worse than the best one.
This pruner is effective for optimizing the mean/median of some (costly-to-evaluate) performance scores over a set of problem instances. When you use this pruner, you must call
Trial.Report(value, step)for each step (instance id) with the evaluated value; the instance id may not be in ascending order. Unlike other pruners, the reported values need not converge to the real value.This pruner cannot handle infinity or NaN values; trials containing those values are never pruned. The scipy dependency is replaced by a self-contained signed-rank test (plan 2.3), verified against scipy.