// The pruner is activated.
study = optuna.create_study(pruner=DeterministicPruner(True))
trial = study._run_trial(func=lambda _: 1.0, catch=(Exception, ))
pruning_callback = XGBoostPruningCallback(trial, "validation-error")
with pytest.raises(optuna.structs.TrialPruned):
pruning_callback(env)
After Change
// The pruner is deactivated.
study = optuna.create_study(pruner=DeterministicPruner(False))
trial = create_running_trial(study, 1.0)
pruning_callback = XGBoostPruningCallback(trial, "validation-error")
pruning_callback(env)
// The pruner is activated.