optuna.pruners.BasePruner

class optuna.pruners.BasePruner[source]

Base class for pruners.

__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__

Initialize self.

prune(study, trial)

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

abstract prune(study: optuna.study.Study, trial: optuna.trial._frozen.FrozenTrial)bool[source]

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, optuna.trial.Trial.report() and optuna.trial.Trial.should_prune() provide user interfaces to implement pruning mechanism in an objective function.

Parameters
  • study – Study object of the target study.

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

Returns

A boolean value representing whether the trial should be pruned.