Binary Log Loss

easy
Unit 2 · Metrics0/3 to milestone

Implement log_loss(y_true, p, eps=1e-15): the mean binary cross-entropy

−1n∑ylog⁡p+(1−y)log⁡(1−p)-\frac{1}{n}\sum y\log p + (1-y)\log(1-p)

Clip probabilities to [eps, 1 - eps] first, so a confident wrong answer gives a large but finite loss instead of infinity.

#metrics#classification#probability2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Binary Log Loss · TechGradify