Skip to content

Commit

Permalink
Test param importances infos with default objective names
Browse files Browse the repository at this point in the history
  • Loading branch information
xadrianzetx committed Oct 3, 2023
1 parent ea02488 commit 0c58dbe
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/visualization_tests/test_param_importances.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,30 @@ def test_get_param_importances_infos_custom_objective_names(
) -> None:
study = specific_create_study()
study.set_metric_names(objective_names)
n_objectives = len(study.directions)

infos = _get_importances_infos(
study, evaluator=None, params=["param_a"], target=None, target_name="Objective Value"
)
assert len(infos) == n_objectives
assert len(infos) == len(study.directions)
assert all(info.target_name == expected for info, expected in zip(infos, objective_names))


@pytest.mark.parametrize(
"specific_create_study,objective_names",
[
(create_study, ["Objective Value"]),
(_create_multiobjective_study, ["Objective Value 0", "Objective Value 1"]),
],
)
def test_get_param_importances_infos_default_objective_names(
specific_create_study: Callable[[], Study], objective_names: list[str]
) -> None:
study = specific_create_study()

infos = _get_importances_infos(
study, evaluator=None, params=["param_a"], target=None, target_name="Objective Value"
)
assert len(infos) == len(study.directions)
assert all(info.target_name == expected for info, expected in zip(infos, objective_names))


Expand Down

0 comments on commit 0c58dbe

Please sign in to comment.