Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fa0866a

Browse files
genvalenjeremiedbb
andauthored
MAINT Parameters validation for sklearn.metrics.matthews_corrcoef (#25712)
Co-authored-by: jeremiedbb <[email protected]>
1 parent 7e15694 commit fa0866a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

sklearn/metrics/_classification.py

Lines 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

Lines 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)