optuna.importance.PedAnovaImportanceEvaluator
- class optuna.importance.PedAnovaImportanceEvaluator(*, target_quantile=0.1, region_quantile=1.0, evaluate_on_local=True)[source]
PED-ANOVA importance evaluator.
Implements the PED-ANOVA hyperparameter importance evaluation algorithm.
PED-ANOVA fits Parzen estimators of
COMPLETEtrials better than a user-specifiedtarget_quantile. The importance can be interpreted as how important each hyperparameter is to get the performance better thantarget_quantile.For further information about PED-ANOVA algorithm, please refer to the following paper:
For further information on how conditional parameters are handled, please refer to the following paper:
target_quantileandregion_quantilecorrespond to the parameters \(\gamma'\) and \(\gamma\) in the original paper, respectively.Note
Behavior on multi-objective studies. If
targetisNone, top-quantile trials are selected in the same manner as multi-objectiveTPESampler: trials are ranked by non-domination rank, with the hypervolume subset selection problem (HSSP) used to break ties within a rank. The resulting importance can be interpreted as how important each hyperparameter is to reach the Pareto front without preference for any particular objective.To compute the importance against a single objective instead, pass a
targetcallable explicitly. Note thatPedAnovaImportanceEvaluatorassumes minimization (i.e., lowertargetvalues are better); when an objective is being maximized, negate it insidetarget:# Objective 0 is being minimized. importance = get_param_importances( study, evaluator=PedAnovaImportanceEvaluator(), target=lambda t: t.values[0], ) # Objective 0 is being maximized—negate so that "lower is better". importance = get_param_importances( study, evaluator=PedAnovaImportanceEvaluator(), target=lambda t: -t.values[0], )
Note
The performance of PED-ANOVA depends on how many trials to consider above
target_quantile. To stabilize the analysis, it is preferable to include at least 5 trials abovetarget_quantile.- Parameters:
target_quantile (float) – Compute the importance of achieving top-
target_quantilequantile objective value. For example,target_quantile=0.1means that the importances give the information of which parameters were important to achieve the top-10% performance during optimization.region_quantile (float) – Define the region where we compute the importance. For example,
region_quantile=0.5means that we compute the importance in the region where trials achieve top-50% performance. Ifregion_quantile=1.0, the importance is computed in the whole search space.evaluate_on_local (bool) – Whether we measure the importance in the local or global space. If
True, the importances imply how importance each parameter is during optimization. Meanwhile,evaluate_on_local=Falsegives the importances in the specified search_space.evaluate_on_local=Trueis especially useful when users modify search space during optimization.
Example
An example of using PED-ANOVA is as follows:
import optuna from optuna.importance import PedAnovaImportanceEvaluator def objective(trial): x1 = trial.suggest_float("x1", -10, 10) x2 = trial.suggest_float("x2", -10, 10) return x1 + x2 / 1000 study = optuna.create_study() study.optimize(objective, n_trials=100) evaluator = PedAnovaImportanceEvaluator() importance = optuna.importance.get_param_importances(study, evaluator=evaluator)
Methods
evaluate(study[, params, target])Evaluate parameter importances based on completed trials in the given study.
- evaluate(study, params=None, *, target=None)[source]
Evaluate parameter importances based on completed trials in the given study.
Note
This method is not meant to be called by library users.
See also
Please refer to
get_param_importances()for how a concrete evaluator should implement this method.- Parameters:
study (Study) – An optimized study.
params (list[str] | None) – A list of names of parameters to assess. If
None, all parameters that appear in completed trials, including conditional parameters, are assessed.target (Callable[[FrozenTrial], float] | None) –
A function to specify the value to evaluate importances. If it is
Noneandstudyis being used for single-objective optimization, the objective values are used. If it isNoneandstudyis being used for multi-objective optimization, the importance of reaching the Pareto front is evaluated by selecting top-quantile trials without preference for any particular objective, using non-domination rank and HSSP tie-breaking. To evaluate importance against a single objective or another trial attribute, specifytargetexplicitly, for exampletarget=lambda t: t.values[0]ortarget=lambda t: t.duration.total_seconds().Note
PedAnovaImportanceEvaluatorassumes lowertargetvalues are better.
- Returns:
A
dictwhere the keys are parameter names and the values are assessed importances.- Return type: