Logarithm
A logarithm, almost always the natural log (base e) in ML papers.
In ML papers
In ML papers almost always means the natural logarithm (base ), so losses come out in nats. Logs turn products of probabilities into sums, , which is why training maximizes the log-likelihood and minimizes the negative log-likelihood (cross-entropy).
How to type it
| LaTeX | Shows |
|---|---|
\log | |
\ln natural log, explicitly | |
\log_2 base 2 |
A worked example
The cross-entropy of a prediction that gave the right answer probability 0.25.
Common confusions
- Information-theory papers may mean (bits). A subscript gives the base when it matters.
Equations that use it
- Cross-entropy loss
- The ELBO
- KL divergence
- DPO loss
- Policy gradient (REINFORCE)
- InfoNCE contrastive loss
- GAN minimax objective
- Perplexity