Probability and statistics

log⁡pθ(x)\log p_\theta(x) Logarithm

A logarithm, almost always the natural log (base e) in ML papers.

In ML papers

In ML papers log⁡\log almost always means the natural logarithm (base ee), so losses come out in nats. Logs turn products of probabilities into sums, log⁡∏ip(xi)=∑ilog⁡p(xi)\log \prod_i p(x_i) = \sum_i \log p(x_i), which is why training maximizes the log-likelihood and minimizes the negative log-likelihood (cross-entropy).

How to type it

LaTeXShows
\loglog⁡\log
\ln natural log, explicitlyln⁡\ln
\log_2 base 2log⁡2\log_2

A worked example

−log⁡0.25≈1.386 nats=2 bits (with log⁡2)-\log 0.25 \approx 1.386 \text{ nats} = 2 \text{ bits } (\text{with } \log_2)

The cross-entropy of a prediction that gave the right answer probability 0.25.

Common confusions

Equations that use it

Related

ex=exp⁡(x)e^{x} = \exp(x)ExponentialDKL(q ∥ p)D_{\mathrm{KL}}(q \,\|\, p)KL divergence∏i=1Np(xi)\prod_{i=1}^{N} p(x_i)Product

Decode this example →