naswot_pruner
Prunes a network when the score is above a user defined limit.
- class NASWOTPruner(*args: Any, **kwargs: Any)[source]
Bases:
BasePruner
Implements the NASWOT method (first version of paper) as an optuna pruner.
This means that before each training of a trial network the network will be tested against a user defined surrogate score (which has to be calibrated). If this score is good enough, the candidate will be trained.
- Parameters:
search_parameters (mala.common.parametes.Parameters) – Parameters used to create this objective.
data_handler (mala.datahandling.data_handler.DataHandler) – datahandler to be used during the hyperparameter optimization.
- prune(study: optuna.study.Study, trial: optuna.trial.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()
andoptuna.trial.Trial.should_prune()
provide user interfaces to implement pruning mechanism in an objective function.- Parameters:
study (optuna.study.Study) – Study object of the target study.
trial (optuna.trial.FrozenTrial) – FrozenTrial object of the target trial. Take a copy before modifying this object.
- Returns:
should_prune – A boolean indicating whether this particular trial should be pruned.
- Return type:
bool