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 fa0866a

Browse filesBrowse files
genvalenjeremiedbb
andauthored
MAINT Parameters validation for sklearn.metrics.matthews_corrcoef (#25712)
Co-authored-by: jeremiedbb <jeremiedbb@yahoo.fr>
1 parent 7e15694 commit fa0866a
Copy full SHA for fa0866a

File tree

2 files changed

+10
-2
lines changed
Filter options

2 files changed

+10
-2
lines changed

‎sklearn/metrics/_classification.py

Copy file name to clipboardExpand all lines: sklearn/metrics/_classification.py
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,13 @@ def jaccard_score(
885885
return np.average(jaccard, weights=weights)
886886

887887

888+
@validate_params(
889+
{
890+
"y_true": ["array-like"],
891+
"y_pred": ["array-like"],
892+
"sample_weight": ["array-like", None],
893+
}
894+
)
888895
def matthews_corrcoef(y_true, y_pred, *, sample_weight=None):
889896
"""Compute the Matthews correlation coefficient (MCC).
890897
@@ -905,10 +912,10 @@ def matthews_corrcoef(y_true, y_pred, *, sample_weight=None):
905912
906913
Parameters
907914
----------
908-
y_true : array, shape = [n_samples]
915+
y_true : array-like of shape (n_samples,)
909916
Ground truth (correct) target values.
910917
911-
y_pred : array, shape = [n_samples]
918+
y_pred : array-like of shape (n_samples,)
912919
Estimated targets as returned by a classifier.
913920
914921
sample_weight : array-like of shape (n_samples,), default=None

‎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.hamming_loss",
128128
"sklearn.metrics.jaccard_score",
129129
"sklearn.metrics.log_loss",
130+
"sklearn.metrics.matthews_corrcoef",
130131
"sklearn.metrics.max_error",
131132
"sklearn.metrics.mean_absolute_error",
132133
"sklearn.metrics.mean_absolute_percentage_error",

0 commit comments

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