Skip to content

Commit 68e9bcf

Browse files
committed
FIX warning interaction problem, DOC clarify parameters
1 parent 86ea13d commit 68e9bcf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sklearn/metrics/metrics.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,8 @@ def matthews_corrcoef(y_true, y_pred):
463463
lb.fit(np.hstack([y_true, y_pred]))
464464
y_true = lb.transform(y_true)
465465
y_pred = lb.transform(y_pred)
466-
mcc = np.corrcoef(y_true, y_pred)[0, 1]
466+
with np.errstate(divide='warn', invalid='warn'):
467+
mcc = np.corrcoef(y_true, y_pred)[0, 1]
467468

468469
if np.isnan(mcc):
469470
return 0.
@@ -1256,6 +1257,9 @@ def _prf_divide(numerator, denominator, metric, modifier, average):
12561257
12571258
On zero-division, sets the corresponding result elements to zero
12581259
and raises a warning.
1260+
1261+
The metric, modifier and average arguments are used only for determining
1262+
an appropriate warning.
12591263
"""
12601264
result = numerator / denominator
12611265
mask = denominator == 0.0

0 commit comments

Comments
 (0)