-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
Closed
Labels
Description
Description
Log_loss uses LabelBibarizer to transform only original y_true, but not to transform y_pred.
Hence array y_true=[1,1,1] is transformed into [0,0,0], while y_pred is unchanged. This makes the result to be quite different from expected.
Sample code
from sklearn.metrics import log_loss
y_true = [1,1,1]
y_pred = [0,0,0]
print(log_loss(y_true,y_pred)) # incorrect, because y_true is transformed into [0,0,0]
print(log_loss(y_pred,y_true)) # correctExpected Results
34.5395759923
34.5395759923
Actual Results
9.99200722163e-16
34.5395759923
Versions
Windows-7-6.1.7601-SP1
Python 3.4.4 |Anaconda 2.3.0 (64-bit)| (default, Feb 16 2016, 09:54:04) [MSC v.1600 64 bit (AMD64)]
NumPy 1.10.4
SciPy 0.16.0
Scikit-Learn 0.16.1