ExponentialFamily
DistributionExponentialFamily(batch_shape: tuple[int, ...] = (), event_shape: tuple[int, ...] = (), validate_args: bool | None = None)Mix-in for exponential-family distributions.
An exponential-family distribution has a density of the form
where:
- are the natural parameters (also called canonical parameters),
- is the vector of sufficient statistics,
- is the log-partition function (log-normaliser), and
- is the base measure.
This family encompasses most common distributions: Normal, Bernoulli, Gamma, Beta, Poisson, Dirichlet, and many more.
Subclasses provide _natural_params and _log_normalizer
so that entropy can be derived from the standard exponential-family
identity
Per-distribution overrides of Distribution.entropy remain
available for closed-form efficiency.
Notes
The exponential family structure implies:
- The log-normalizer is convex in .
- (the mean parameter).
- The Hessian equals the covariance matrix of , hence is always positive semi-definite.
These properties underpin many elegant results in information geometry, variational inference, and natural gradient methods.
Members of this family in lucid.distributions include
lucid.distributions.Normal,
lucid.distributions.Bernoulli,
lucid.distributions.Categorical,
lucid.distributions.Gamma,
lucid.distributions.Beta,
lucid.distributions.Dirichlet,
lucid.distributions.Exponential, and
lucid.distributions.Poisson. Heavy-tailed families such
as lucid.distributions.Cauchy and Student's-t are not
members.
Examples
>>> import lucid
>>> from lucid.distributions import Bernoulli
>>> d = Bernoulli(probs=0.7) # ExponentialFamily subclass
>>> isinstance(d, lucid.distributions.distribution.ExponentialFamily)
True
>>> d.entropy()
Tensor(...)