Skip to content
fn

expit

→Tensor
expit(input: Tensor)

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. Unlike lucid.sigmoid it accepts a complex input, evaluated as 1/(1+e−z)1 / (1 + e^{-z}) in real arithmetic.

Parameters

inputTensor
Input tensor; any floating-point or complex dtype.

Returns

Tensor

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

Notes

Definition:

σ(x)=11+e−x=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.5, 0.8808])