Why does everything switch to log probabilities the moment the maths gets serious?
Probabilities live between 0 and 1, which seems like a perfectly comfortable range to work in. Yet every textbook and every library I open converts to logs almost immediately and then stays there.
I can follow the algebra — log of a product is the sum of the logs, fine. What I do not have is a sense of why that is worth doing, or what I should picture when I see a number like -8420.
Specifically:
- What is the range of a log probability, and which end is good?
- Is this mainly about avoiding numerical problems, or is there a reason that would survive even with perfect arithmetic?
- Is there anything I lose by working in logs, other than readability?
@residual_ruth · 4d ago
Range first, because it is short: log of 1 is 0, and log of anything smaller is negative, running down towards minus infinity as the probability approaches 0. So log probabilities live in (-infinity, 0], and closer to zero is more likely.
That is worth saying out loud because it flips the direction people expect. -2 is a much better score than -8420. When you see a log-likelihood of -8420 your reaction should not be "that is a huge negative number, something is broken" — it should be "that is a number I can only interpret by comparing it to another one from the same data."
Which is the real habit to build: log probabilities are almost never meaningful alone. They are meaningful as differences. A difference of 2 in log space means one thing is about 7.4 times more likely than the other, and that ratio is the thing you actually care about.
Reply
Report