fn

expit

Tensor
expit(x: Tensor)
source

Logistic sigmoid (expit) function σ(x)\sigma(x).

Convenience alias for lucid.sigmoid. Maps the real line onto the open interval (0,1)(0, 1) and is the inverse of lucid.logit.

Parameters

xTensor
Input tensor; any floating-point dtype.

Returns

Tensor

σ(x)=1/(1+ex)\sigma(x) = 1 / (1 + e^{-x}) element-wise, same shape and dtype as x.

Notes

Definition:

σ(x)=11+ex=ex1+ex.\sigma(x) = \frac{1}{1 + e^{-x}} = \frac{e^x}{1 + e^x}.

Symmetry: σ(x)=1σ(x)\sigma(-x) = 1 - \sigma(x). Derivative: σ(x)=σ(x)(1σ(x))\sigma'(x) = \sigma(x)\,(1 - \sigma(x)). Frequently used as the probabilistic-output activation of binary classifiers.

Examples

>>> import lucid
>>> from lucid.special import expit
>>> expit(lucid.tensor([-2.0, 0.0, 2.0]))
Tensor([0.1192, 0.5000, 0.8808])