AI Grounds
Open AI Grounds on a desktop
These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.
AI Grounds
These interactive lessons need a larger screen. Please continue on a desktop or laptop computer.
Guided discovery
Put probability on what happened.
One yes/no question: No + Yes = 100%. No is the complement of Yes.
The target records what happened. Changing it keeps the predicted probabilities fixed.
No probability is 100% minus this value. Use arrow keys on the slider. Press Enter or leave the number field to apply an exact edit.
Bars share a fixed 0–100% scale. A target of 1 marks a true outcome or label; 0 marks a false one.
Contribution = 0 (this class is not the actual outcome).
Contribution = −ln(0.7) ≈ 0.356675 nats.
Surprise for this known target, measured in natural-log units called nats.
0.357
−ln(probability of the true outcome)
Only the actual outcome’s probability sets this loss.
Probability across mutually exclusive outcomes.
100%
Probabilities sum to 100%
Changing one class automatically adjusts the others.
ln is the natural logarithm. The negative log −ln(p) measures surprise: larger probability on what happened means less loss. These are per-example losses, not accuracy.
The categorical expression −sum(y × ln(p)) reduces to −ln(pTrue) for a one-hot target. Binary uses the same idea for No/Yes: actual Yes uses −ln(pYes), actual No uses −ln(1−pYes).
| Class / label | Target | Prediction | Contribution (nats) |
|---|---|---|---|
| No | 0 | 0.3 | 0 |
| Yes | 1 | 0.7 | 0.356675 |
−ln(probability of the true outcome): ≈ 0.356675 nats.
These controls deliberately avoid 0% and 100%. Mathematically, assigning zero probability to an event that happened gives infinite loss; assigning probability one gives zero loss. For a false label, its event is absence, with probability 1−p.
Three fixed examples for this mode. They are comparisons rather than controls.
| Case | True outcomes / labels | Predictions (%) | Loss (nats) |
|---|---|---|---|
| High probability on the true outcome | Yes | No 10; Yes 90 | 0.105361 |
| Medium probability on the true outcome | Yes | No 60; Yes 40 | 0.916291 |
| Low probability on the true outcome | Yes | No 99; Yes 1 | 4.60517 |
Lower loss rewards probabilities consistent with the known target. It does not supply a universal good/bad cutoff, prove calibration, or substitute for evaluation on other examples.
binary. True Yes. No prediction 30%, target 0, contribution 0 nats; Yes prediction 70%, target 1, contribution 0.356675 nats. Cross entropy 0.356675 nats; prediction total 100%.