Meaning and conditions
Binary log loss scores the predicted probability assigned to the observed label. Calculate one case with y=0 or y=1 using the natural logarithm.[1]
Binary log loss is the two-class special case of cross-entropy. The neighbouring article already covers general distributions, soft targets and logarithm bases. Here the emphasis is hard-label coding, individual confident errors and averaging different cases.[1]
Reasoning step by step
- Define p as the prediction for the explicitly named label 1.
- For y=1 retain −ln p; for y=0 retain −ln(1−p).
- Evaluate only the term belonging to the observed label.
- Sum individual losses and divide by case count for the unweighted mean.
Units, inverses and limits
y is exactly zero or one; p lies between zero and one. The limiting 0·ln 0 contribution of an unobserved class is treated as zero. A certainly correct case has zero loss. A certainly wrong case has infinite loss and is rejected by the finite calculator without silent clipping.[1]
Two fully worked examples
A negative label
- Given
- y=0; p=0.15 for label 1.
- Find
- Calculate one-case loss.
Find probability assigned to the observed label.
Evaluate negative natural logarithm.
Result: ℓ≈0.162519 nats.
Check: A predicted probability of 0.85 for the true label gives a small positive loss.
Two differently confident cases
- Given
- (y,p)=(1,0.9) and (0,0.8).
- Find
- Find mean loss.
Score each case using its actual class.
Average losses with equal weights.
Result: Mean log loss about 0.857399 nats.
Check: −ln√(0.9·0.2) gives the same mean; the confident error dominates.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Seeing the relationship
Binary log loss: confident errors and mean loss
Free with a Quanta account. Your download stays ready after registration.
Five exercises with solutions
Calculate · Foundation
y=1 and p=0.5: calculate loss.
Show hint
Use the stated definition and check its assumptions.
Learning goal: Apply logarithm to the true label.
Rearrange · Application
For y=1, ℓ=ln 5. Which p gives this?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Invert a loss value.
Interpret · Application
For y=0 compare predictions p=0.1 and p=0.9.
Show hint
Use the stated definition and check its assumptions.
Learning goal: Interpret the confidence of an error.
Show solution and calculation
Losses are −ln 0.9≈0.105361 and −ln 0.1≈2.302585.
The confident incorrect prediction is penalized more.
Error analysis · Application
Someone averages p=0.9 and p=0.1 before taking −ln 0.5 for two positive labels. Is that mean log loss?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Respect the order of logarithm and averaging.
Show solution and calculation
No.
The correct mean is −(ln 0.9+ln 0.1)/2≈1.203973.
Taking the logarithm of the arithmetic mean gives a different result.
Transfer · Challenge
Reverse both label names and replace p by 1−p. What happens to ℓ?
Show hint
Use the stated definition and check its assumptions.
Learning goal: Check invariance under consistent recoding.
Show solution and calculation
With ynew=1−y and pnew=1−p, the two terms exchange places.
Loss is unchanged.
Check your understanding with the formula’s reference test.
7 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Continue learning
Connect this calculation to cross-entropy and Bernoulli likelihood.
Sources for this explanation
Quanta · Updated November 9, 2026
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added a full article with original DE/EN examples, exercises, models and source checks.
Cite this reference page
Quanta. Binary log loss. Updated November 9, 2026. https://quanta-study.de/en/formula-sheet/binaerer-log-loss
When citing a specific scientific statement, also cite the specialist source linked to that statement.