Functions and operators

logit⁡(p)=log⁡p1−p\operatorname{logit}(p) = \log \frac{p}{1 - p} Logit and logits

The log-odds log(p/(1−p)), the inverse of the sigmoid; “logits” are the raw scores before a softmax.

In ML papers

logit⁡(p)=log⁡p1−p\operatorname{logit}(p) = \log \frac{p}{1-p} is the log-odds of a probability pp. It maps (0,1)(0, 1) to all real numbers and undoes the sigmoid: σ(logit⁡(p))=p\sigma(\operatorname{logit}(p)) = p.

In everyday ML usage, logits means something looser: the raw, unnormalized scores z\mathbf{z} a network outputs before the softmax (Softmax) or sigmoid. They can be any real numbers; only their differences matter to a softmax. Loss functions take logits directly because computing log⁡softmax⁡\log \operatorname{softmax} in one step is more stable.

How to type it

LaTeXShows
\operatorname{logit}(p)logit⁡(p)\operatorname{logit}(p)

A worked example

logit⁡(0.8)=log⁡0.80.2=log⁡4≈1.386\operatorname{logit}(0.8) = \log \frac{0.8}{0.2} = \log 4 \approx 1.386

And logit⁡(0.5)=0\operatorname{logit}(0.5) = 0: even odds.

Common confusions

Related

σ(z)\sigma(z)Sigma (lowercase)softmax⁡(z)i=ezi∑jezj\operatorname{softmax}(\mathbf{z})_i = \frac{e^{z_i}}{\sum_j e^{z_j}}Softmaxlog⁡pθ(x)\log p_\theta(x)Logarithm

Decode this example →