a0c596d6ec16a9f01d906ad98bafaf7e62ef9311,tests/importance_tests/test_init.py,,test_get_param_importances_with_target,#Any#Any#,139

Before Change


            value += x4
        return value

    study = create_study(storage_init_func())
    study.optimize(objective, n_trials=3)

    param_importance = get_param_importances(
        study,

After Change


            value += x4
        return value

    with StorageSupplier(storage_mode) as storage:
        study = create_study(storage=storage)
        study.optimize(objective, n_trials=3)

        param_importance = get_param_importances(
            study,
            evaluator=evaluator_init_func(),
            target=lambda t: t.params["x1"] + t.params["x2"],
        )

        assert isinstance(param_importance, OrderedDict)
        assert len(param_importance) == 3
        assert all(param_name in param_importance for param_name in ["x1", "x2", "x3"])
        prev_importance = float("inf")
        for param_name, importance in param_importance.items():
            assert isinstance(param_name, str)
            assert isinstance(importance, float)
            assert importance <= prev_importance
            prev_importance = importance
        assert math.isclose(1.0, sum(param_importance.values()), abs_tol=1e-5)


@parametrize_evaluator
def test_get_param_importances_invalid_empty_study(
    evaluator_init_func: Callable[[], BaseImportanceEvaluator]
) -> None:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: pfnet/optuna
Commit Name: a0c596d6ec16a9f01d906ad98bafaf7e62ef9311
Time: 2021-02-27
Author: k_nzw@klis.tsukuba.ac.jp
File Name: tests/importance_tests/test_init.py
Class Name:
Method Name: test_get_param_importances_with_target


Project Name: pfnet/optuna
Commit Name: 754642db5ff35be98e4b6fc3a17823482881cb27
Time: 2020-04-29
Author: ytsmiling@gmail.com
File Name: tests/storages_tests/test_storages.py
Class Name:
Method Name: test_get_all_study_summaries


Project Name: pfnet/optuna
Commit Name: 280c4fb338bbb4cc967adfcc9714f05a606c6acf
Time: 2020-04-29
Author: ytsmiling@gmail.com
File Name: tests/storages_tests/test_storages.py
Class Name:
Method Name: test_get_all_study_summaries


Project Name: pfnet/optuna
Commit Name: a0c596d6ec16a9f01d906ad98bafaf7e62ef9311
Time: 2021-02-27
Author: k_nzw@klis.tsukuba.ac.jp
File Name: tests/importance_tests/test_init.py
Class Name:
Method Name: test_get_param_importances_with_params