-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Closed
Description
Describe the bug
log_loss(y_true, y_pred) renormalizes y_pred internally such that it sums to 1. This way, a really bad model, the predictions of which do not sum to 1, gets a better loss then it actually has.
Steps/Code to Reproduce
from scipy.special import xlogy
from sklearn.metrics import log_loss
y_true = [[0, 1]]
y_pred = [[0.2, 0.3]]
log_loss(y_true, y_pred)Expected Results
-xlogy(y_true, y_pred).sum(axis=1)Result: 1.2039728
Actual Results
Result: 0.5108256237659907
Versions
System:
python: 3.9.14
machine: macOS
Python dependencies:
sklearn: 1.1.2