8000 MNT Use regression data for `check_sample_weight_invariance` test on multioutput regression metrics by lucyleeow · Pull Request #30829 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MNT Use regression data for check_sample_weight_invariance test on multioutput regression metrics #30829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion sklearn/metrics/tests/test_common.py
Original file line number Diff line number Diff line change
9500 Expand Up @@ -1611,7 +1611,7 @@ def test_multiclass_sample_weight_invariance(name):
@pytest.mark.parametrize(
"name",
sorted(
(MULTILABELS_METRICS | THRESHOLDED_MULTILABEL_METRICS | MULTIOUTPUT_METRICS)
(MULTILABELS_METRICS | THRESHOLDED_MULTILABEL_METRICS)
- METRICS_WITHOUT_SAMPLE_WEIGHT
),
)
Expand All @@ -1638,6 +1638,19 @@ def test_multilabel_sample_weight_invariance(name):
check_sample_weight_invariance(name, metric, y_true, y_pred)


@pytest.mark.parametrize(
"name",
sorted(MULTIOUTPUT_METRICS - METRICS_WITHOUT_SAMPLE_WEIGHT),
)
def test_multioutput_sample_weight_invariance(name):
random_state = check_random_state(0)
y_true = random_state.uniform(0, 2, size=(20, 5))
y_pred = random_state.uniform(0, 2, size=(20, 5))

metric = ALL_METRICS[name]
check_sample_weight_invariance(name, metric, y_true, y_pred)


def test_no_averaging_labels():
# test labels argument when not using averaging
# in multi-class and multi-label cases
Expand Down
Loading
0