optuna.importance.FanovaImportanceEvaluator

class optuna.importance.FanovaImportanceEvaluator(*, n_trees=64, max_depth=64, seed=None)[源代码]

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.

备注

Requires the sklearn Python package.

备注

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.

备注

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.

备注

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

参数
  • n_trees (int) – The number of trees in the forest.

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

  • seed (Optional[int]) – Controls the randomness of the forest. For deterministic behavior, specify a value other than None.

返回类型

None

Methods

evaluate(study[, params, target])

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

evaluate(study, params=None, *, target=None)[源代码]

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

备注

This method is not meant to be called by library users.

参见

Please refer to get_param_importances() for how a concrete evaluator should implement this method.

参数
  • study (optuna.study.Study) – An optimized study.

  • params (Optional[List[str]]) – A list of names of parameters to assess. If None, all parameters that are present in all of the completed trials are assessed.

  • target (Optional[Callable[[optuna.trial._frozen.FrozenTrial], float]]) –

    A function to specify the value to evaluate importances. If it is None and study is being used for single-objective optimization, the objective values are used.

    备注

    Specify this argument if study is being used for multi-objective optimization.

返回

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

引发

ValueError – If target is None and study is being used for multi-objective optimization.

返回类型

Dict[str, float]