Log loss is sharp about confident mistakes, and sometimes that sharpness is more than you want. The Brier score is the mean squared error between the predicted probability and the 0/1 outcome. It is bounded between 0 and 1, so a single extreme miss cannot dominate it the way it can in log loss.
Implement brier_score(y_true, y_prob) for binary labels, where y_prob is the predicted probability of class 1.
Return mean((p − y)²).
y_true values must be 0 or 1, and y_prob values must lie in [0, 1]. Otherwise raise ValueError.Open one at a time. Each gives away a little more than the last.
Subtract the labels from the probabilities element by element, then square.
np.mean of the squared differences is the whole answer.
No results yet
Run your code to check it against the examples, or submit to run every test.