On four test examples with true labels y=[1,1,0,0], Model A predicts probabilities [0.90,0.90,0.10,0.99] and Model B predicts [0.70,0.70,0.30,0.55]. Both achieve 75% accuracy at threshold 0.5; what is the binary log loss of each model, and why do they differ so sharply?

ML systems and evaluation, Classification metrics
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can compute binary cross-entropy (log loss) and understand why it penalises overconfident errors.

Key idea

Binary log loss is L=−1N∑i=1N[yiln⁡p^i+(1−yi)ln⁡(1−p^i)], where N is the number of examples and p^i is the predicted probability of class 1; as the probability assigned to the true class approaches 0, −ln⁡(⋅) grows toward ∞.

Steps

  1. For Model A on y=[1,1,0,0], the probabilities assigned to the true classes are [0.90,0.90,0.90,0.01].
  2. Compute Model A’s log loss (in nats): LA=−14(3ln⁡0.90+ln⁡0.01)≈−14(3(−0.10536)−4.60517)=4.921254≈1.230.
  3. For Model B, the true-class probabilities are [0.70,0.70,0.70,0.45], giving LB=−14(3ln⁡0.70+ln⁡0.45)≈−14(3(−0.35667)−0.79851)=1.868524≈0.467.
  4. Explain the gap: accuracy treats both 0.99 and 0.55 on the fourth point as identical mistakes, whereas log loss heavily penalises Model A’s 99% confidence on a false positive (−ln⁡0.01≈4.61 vs −ln⁡0.45≈0.80).

Common mistakes

How long your answer should be

Four lines of arithmetic and two sentences of interpretation; 3 minutes.

Read this

Previous in ML systems and evaluation: A disease screening model tested on 200 patients produces TP=36, FN=4, FP=24 and TN=136. What are precision, recall, F1 and F2, and why does a screening task favour β>1?
Next in ML systems and evaluation: A regression model predicts y^=[2,4,6,8] for true targets y=[2,4,6,12]. What are the MAE and RMSE, why is RMSE strictly larger here, and when is each metric preferred?