optuna.importance.FanovaImportanceEvaluator

class optuna.importance.FanovaImportanceEvaluator(*, n_trees: int = 64, max_depth: int = 64, seed: Optional[int] = None)[source]

fANOVA importance evaluator.

Implements the fANOVA hyperparameter importance evaluation algorithm in An Efficient Approach for Assessing Hyperparameter Importance.

Given a study, fANOVA fits a random forest regression model that predicts the objective value given a parameter configuration. The more accurate this model is, the more reliable the importances assessed by this class are.

Note

Requires the sklearn Python package.

Note

Pairwise and higher order importances are not supported through this class. They can be computed using _Fanova directly but is not recommended as interfaces may change without prior notice.

Note

The performance of fANOVA depends on the prediction performance of the underlying random forest model. In order to obtain high prediction performance, it is necessary to cover a wide range of the hyperparameter search space. It is recommended to use an exploration-oriented sampler such as RandomSampler.

Note

For how to cite the original work, please refer to https://automl.github.io/fanova/cite.html.

Parameters
  • n_trees – The number of trees in the forest.

  • max_depth – The maximum depth of the trees in the forest.

  • seed – Controls the randomness of the forest. For deterministic behavior, specify a value other than None.

__init__(*, n_trees: int = 64, max_depth: int = 64, seed: Optional[int] = None) None[source]

Methods

__init__(*[, n_trees, max_depth, seed])

evaluate(study[, params])

Evaluate parameter importances based on completed trials in the given study.

evaluate(study: optuna.study.Study, params: Optional[List[str]] = None) Dict[str, float][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 – An optimized study.

  • params – A list of names of parameters to assess. If None, all parameters that are present in all of the completed trials are assessed.

Returns

An collections.OrderedDict where the keys are parameter names and the values are assessed importances.