Table of Contents

Class MedianPruner

Namespace
OptunaSharp.Pruners
Assembly
OptunaSharp.dll

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:

  1. If all intermediate values of the current trial are NaN, the trial will be pruned.
  2. During the median calculation across completed trials, NaN values are ignored. Only valid numeric values are considered.
public class MedianPruner : PercentilePruner
Inheritance
MedianPruner
Inherited Members

Constructors

MedianPruner(int, int, int, int)

Configures the percentile stopping rule with a fixed 50th-percentile cutoff.

public MedianPruner(int nStartupTrials = 5, int nWarmupSteps = 0, int intervalSteps = 1, int nMinTrials = 1)

Parameters

nStartupTrials int

Pruning is disabled until the given number of trials finish in the same study.

nWarmupSteps int

Pruning is disabled while the current step is less than nWarmupSteps; the earliest a trial can be pruned is at step == nWarmupSteps.

intervalSteps int

Interval in number of steps between the pruning checks, offset by the warmup steps.

nMinTrials int

Minimum number of reported trial results at a step to judge whether to prune.

Exceptions

ValueError

A startup/warmup count is negative, or an interval/minimum count is below one.

See Also