class

SigmoidTransform

extendsTransform
SigmoidTransform()
source

Element-wise sigmoid bijection y=σ(x)=1/(1+ex)y = \sigma(x) = 1/(1 + e^{-x}).

Maps R(0,1)\mathbb{R} \to (0, 1) element-wise. The natural unconstrained → probability transform — composed with a base distribution on R\mathbb{R}, the pushforward lives on the unit interval. Monotone increasing, bijective, event_dim = 0.

Notes

Forward: y=σ(x)=1/(1+ex)y = \sigma(x) = 1/(1 + e^{-x}).

Inverse (logit): x=log ⁣(y/(1y))x = \log\!\bigl(y/(1-y)\bigr).

Log Jacobian determinant:

log ⁣yx=log(σ(x)(1σ(x)))=logy+log(1y)\log\!\left|\frac{\partial y}{\partial x}\right| = \log\bigl(\sigma(x)(1 - \sigma(x))\bigr) = \log y + \log(1 - y)

The transform is closely related to the StickBreakingTransform (which generalises to the simplex) and to TanhTransform (which targets (1,1)(-1, 1)).

Examples

>>> import lucid
>>> from lucid.distributions.transforms import SigmoidTransform
>>> T = SigmoidTransform()
>>> y = T(lucid.tensor(0.0))  # σ(0) = 0.5
Tensor(0.5)

Methods (1)

fn

log_abs_det_jacobian

Tensor
log_abs_det_jacobian(x: Tensor, y: Tensor)
source

Log-Jacobian log(y(1y))\log\bigl(y\,(1-y)\bigr) of the sigmoid map.