From 42bfb66ef394b714ba7610526a4f6b6457e40f27 Mon Sep 17 00:00:00 2001 From: Auguste Baum Date: Tue, 4 Mar 2025 11:50:37 +0100 Subject: [PATCH] add failing test --- .../test_permutation_importance.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/skore/tests/unit/sklearn/estimator/feature_importance/test_permutation_importance.py b/skore/tests/unit/sklearn/estimator/feature_importance/test_permutation_importance.py index ee71bebe9..8b84d71d3 100644 --- a/skore/tests/unit/sklearn/estimator/feature_importance/test_permutation_importance.py +++ b/skore/tests/unit/sklearn/estimator/feature_importance/test_permutation_importance.py @@ -255,6 +255,22 @@ def test_cache_random_state(regression_data): pd.testing.assert_frame_equal(cached_result, result) +def test_cache_scoring(regression_data): + """`scoring` is in the cache.""" + + X, y = regression_data + report = EstimatorReport(LinearRegression(), X_train=X, y_train=y) + + report.feature_importance.feature_permutation( + data_source="train", scoring="r2", random_state=42 + ) + report.feature_importance.feature_permutation( + data_source="train", scoring="neg_root_mean_squared_error", random_state=42 + ) + # Scorings are different, so cache keys should be different + assert len(report._cache) == 2 + + @pytest.mark.parametrize( "scoring", [