All problems
Brier Score
Problem
Compute the Brier score for binary probability predictions: (1/n) * sum((p_i - y_i)^2).
Empty input returns 0.0.
Hint
It is the mean squared error between predicted probabilities and 0/1 labels.
Test cases
case 1
in: [[1,0,1,0],[0.9,0.1,0.8,0.2]]
expected: 0.024999999999999994
case 2
in: [[1,1],[0.5,0.5]]
expected: 0.25
case 3
in: [[0,0],[0,1]]
expected: 0.5
case 4
in: [[],[]]
expected: 0
Starter codePython
def brier_score(y_true, y_pred):
# Your code here
pass4 test cases · run your code against them in the editor