Log Probability
Since probabilities of independent events multiply, and log converts multiplication to addition, log probabilities of independent events add.
Super useful in research, I see it everywhere.
Note
Taking the exponential of a value in log-space will take it out (recall inverse of natural log), e.g.,
np.log(1) >> 0 np.exp(0) >> 1
Motivation
- Speed. Multiplication more expensive than addition.
- Accuracy. Improves the numerical stability, when the probabilities are very small, because of floating point arithmetic.
- Simplicity. Log of probability distribution removes the exponential function.
- Optimization. Optimizers work better with log probabilities.