class optuna.importance.MeanDecreaseImpurityImportanceEvaluator(*, n_trees=64, max_depth=64, seed=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.


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

  • n_trees (int) – Number of trees in the random forest.

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

  • seed (Optional[int]) – Seed for the random forest.


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.


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.

  • 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[[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. Can also be used for other trial attributes, such as the duration, like target=lambda t: t.duration.total_seconds().


    Specify this argument if study is being used for multi-objective optimization. For example, to get the hyperparameter importance of the first objective, use target=lambda t: t.values[0] for the target parameter.


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

Return type

Dict[str, float]