Table of Contents

Class SuccessiveHalvingPruner

Namespace
OptunaSharp.Pruners
Assembly
OptunaSharp.dll

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.

public class SuccessiveHalvingPruner : BasePruner
Inheritance
SuccessiveHalvingPruner
Inherited Members

Constructors

SuccessiveHalvingPruner(long?, int, int, int)

Configures asynchronous rung promotion and its minimum resource budget.

public SuccessiveHalvingPruner(long? minResource = null, int reductionFactor = 4, int minEarlyStoppingRate = 0, int bootstrapCount = 0)

Parameters

minResource long?

The minimum resource allocated to a trial (r in the paper), or null for Optuna's "auto": the value is determined based on a heuristic that looks at the number of required steps for the first trial to complete.

reductionFactor int

Reduction factor of promotable trials (eta in the paper). At the completion point of each rung, about 1/reductionFactor trials will be promoted.

minEarlyStoppingRate int

The minimum early-stopping rate (s in the paper).

bootstrapCount int

Minimum number of trials that need to complete a rung before any trial is considered for promotion into the next rung.

Exceptions

ValueError

The minimum resource is below one, the reduction factor is below two, an early-stopping/bootstrap count is negative, or positive bootstrap is combined with automatic minimum resource.

Methods

Prune(Study, FrozenTrial)

Judge whether the trial should be pruned based on the reported values.

Note that this method is not supposed to be called by library users. Instead, Report(double, long) and ShouldPrune() provide user interfaces to implement pruning mechanism in an objective function.

public override bool Prune(Study study, FrozenTrial trial)

Parameters

study Study

Study object of the target study.

trial FrozenTrial

FrozenTrial object of the target trial. Take a copy before modifying this object.

Returns

bool

A boolean value representing whether the trial should be pruned.

Exceptions

RuntimeError

The study has multiple objectives and the pruning rule requests its scalar direction.

See Also