Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2c867b8

Browse filesBrowse files
MAINT Parameters validation for metrics.label_ranking_loss (#25742)
Co-authored-by: Jérémie du Boisberranger <34657725+jeremiedbb@users.noreply.github.com>
1 parent d926ff1 commit 2c867b8
Copy full SHA for 2c867b8

File tree

2 files changed

+10
-2
lines changed
Filter options

2 files changed

+10
-2
lines changed

‎sklearn/metrics/_ranking.py

Copy file name to clipboardExpand all lines: sklearn/metrics/_ranking.py
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,13 @@ def coverage_error(y_true, y_score, *, sample_weight=None):
12241224
return np.average(coverage, weights=sample_weight)
12251225

12261226

1227+
@validate_params(
1228+
{
1229+
"y_true": ["array-like", "sparse matrix"],
1230+
"y_score": ["array-like"],
1231+
"sample_weight": ["array-like", None],
1232+
}
1233+
)
12271234
def label_ranking_loss(y_true, y_score, *, sample_weight=None):
12281235
"""Compute Ranking loss measure.
12291236
@@ -1242,10 +1249,10 @@ def label_ranking_loss(y_true, y_score, *, sample_weight=None):
12421249
12431250
Parameters
12441251
----------
1245-
y_true : {ndarray, sparse matrix} of shape (n_samples, n_labels)
1252+
y_true : {array-like, sparse matrix} of shape (n_samples, n_labels)
12461253
True binary labels in binary indicator format.
12471254
1248-
y_score : ndarray of shape (n_samples, n_labels)
1255+
y_score : array-like of shape (n_samples, n_labels)
12491256
Target scores, can either be probability estimates of the positive
12501257
class, confidence values, or non-thresholded measure of decisions
12511258
(as returned by "decision_function" on some classifiers).

‎sklearn/tests/test_public_functions.py

Copy file name to clipboardExpand all lines: sklearn/tests/test_public_functions.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def _check_function_param_validation(
127127
"sklearn.metrics.f1_score",
128128
"sklearn.metrics.hamming_loss",
129129
"sklearn.metrics.jaccard_score",
130+
"sklearn.metrics.label_ranking_loss",
130131
"sklearn.metrics.log_loss",
131132
"sklearn.metrics.matthews_corrcoef",
132133
"sklearn.metrics.max_error",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.