Cauchy
DistributionCauchy(loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)Cauchy distribution on — heavy-tailed, all moments undefined.
The canonical example of a pathological heavy-tailed distribution: its tails decay so slowly that no integer moment (mean, variance, skew, kurtosis) is defined. The Cauchy is the Student's-t distribution with one degree of freedom and arises naturally as the ratio of two independent standard Normals.
Parameters
Notes
Probability density:
Cumulative distribution:
Properties (no moments — all are undefined or infinite):
- Median / mode:
- Mean / variance: undefined (integrals diverge)
- Entropy:
Sample mean does not converge — the strong law of large numbers fails for IID Cauchy variates. Any finite-sample average of Cauchy draws is itself Cauchy-distributed with the same parameters.
Stability: a sum of independent Cauchy variables remains Cauchy (it is an -stable distribution with stability index 1).
Reparameterised sampling uses the inverse-CDF .
Examples
>>> import lucid
>>> from lucid.distributions import Cauchy
>>> d = Cauchy(loc=0.0, scale=1.0)
>>> d.rsample((4,))
Tensor([...])
>>> d.log_prob(lucid.tensor(0.0))
Tensor(-1.1447)Used by 3
Constructors
1__init__
→None__init__(loc: Tensor | float, scale: Tensor | float, validate_args: bool | None = None)Construct a Cauchy distribution.
Parameters
Notes
The Cauchy distribution has PDF:
The Cauchy is the Student's t-distribution with one degree of freedom. Because all moments of order are undefined, it is a canonical example of a heavy-tailed distribution where the sample mean does not converge to any value.
Examples
>>> from lucid.distributions import Cauchy
>>> d = Cauchy(loc=0.0, scale=1.0)
>>> x = d.rsample((1000,))Instance methods
4Shannon entropy of the Cauchy distribution (in nats).
Returns
TensorEntropy in nats, shape batch_shape.
Examples
>>> Cauchy(loc=0.0, scale=1.0).entropy() # log(4π) ≈ 2.531
Tensor(2.5310)Reparameterised sample via the inverse-CDF method.
Uses the quantile function of the Cauchy distribution:
where . Gradients flow through both and .
Parameters
sample_shapetuple[int, ...]= ()().Returns
TensorReparameterised samples of shape sample_shape + batch_shape.
Examples
>>> d = Cauchy(loc=0.0, scale=1.0)
>>> x = d.rsample((500,))