optuna.importance.MeanDecreaseImpurityImportanceEvaluator

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

Mean Decrease Impurity (MDI) parameter importance evaluator.

This evaluator fits a random forest that predicts objective values given hyperparameter configurations. Feature importances are then computed using MDI.

Note

This evaluator requires the sklean Python package and is based on sklearn.ensemble.RandomForestClassifier.feature_importances_.

Parameters
  • n_trees – Number of trees in the random forest.

  • max_depth – The maximum depth of each tree in the random forest.

  • seed – Seed for the random forest.

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

Initialize self. See help(type(self)) for accurate signature.

Methods

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

Initialize self.

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.