Skip to content

Commit

Permalink
changed the rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelFu512 committed May 14, 2024
1 parent d03bf5d commit 7a1e540
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions evalml/tests/model_understanding_tests/test_partial_dependence.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def test_partial_dependence_more_categories_than_grid_resolution(
fraud_local,
logistic_regression_binary_pipeline,
):
def round_dict_keys(dictionary, places=6):
def round_dict_keys(dictionary, places=3):

Check warning on line 716 in evalml/tests/model_understanding_tests/test_partial_dependence.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/model_understanding_tests/test_partial_dependence.py#L716

Added line #L716 was not covered by tests
"""Function to round all keys of a dictionary that has floats as keys."""
dictionary_rounded = {}
for key in dictionary:
Expand Down Expand Up @@ -753,10 +753,8 @@ def round_dict_keys(dictionary, places=6):
grid_resolution=round(num_cat_features / 2),
)
part_dep_dict = dict(part_dep["partial_dependence"].value_counts())
assert part_dep_ans_rounded == pytest.approx(
round_dict_keys(part_dep_dict),
rel=1e-2,
)
assert part_dep_ans_rounded == round_dict_keys(part_dep_dict)

fast_part_dep = partial_dependence(
pipeline,
X,
Expand All @@ -776,10 +774,7 @@ def round_dict_keys(dictionary, places=6):
grid_resolution=round(num_cat_features),
)
part_dep_dict = dict(part_dep["partial_dependence"].value_counts())
assert part_dep_ans_rounded == pytest.approx(
round_dict_keys(part_dep_dict),
rel=1e-2,
)
assert part_dep_ans_rounded == round_dict_keys(part_dep_dict)

fast_part_dep = partial_dependence(
pipeline,
Expand All @@ -800,10 +795,8 @@ def round_dict_keys(dictionary, places=6):
grid_resolution=round(num_cat_features * 2),
)
part_dep_dict = dict(part_dep["partial_dependence"].value_counts())
assert part_dep_ans_rounded == pytest.approx(
round_dict_keys(part_dep_dict),
rel=1e-2,
)
assert part_dep_ans_rounded == round_dict_keys(part_dep_dict)

fast_part_dep = partial_dependence(
pipeline,
X,
Expand Down

0 comments on commit 7a1e540

Please sign in to comment.