All problems
Log Loss Binary
Problem
Binary log loss is -mean_i (y_i log(p_i) + (1 - y_i) log(1 - p_i)).
Given predicted probabilities (strictly between 0 and 1) and binary outcomes, return the log loss.
Hint
Only the probability assigned to the observed outcome counts.
Test cases
case 1
in: [[0.8,0.2],[1,0]]
expected: 0.2231435513142097
case 2
in: [[0.5,0.5],[0,1]]
expected: 0.6931471805599453
case 3
in: [[0.9,0.1],[1,0]]
expected: 0.10536051565782628
Starter codePython
def log_loss_binary(probs, outcomes):
# Your code here
pass3 test cases · run your code against them in the editor