class
InverseGamma
extends
DistributionInverseGamma(concentration: Tensor | float, rate: Tensor | float, validate_args: bool | None = None)Inverse-Gamma distribution on .
Distribution of the reciprocal of a Gamma random variable: if then . Widely used as the conjugate prior for the variance parameter of a Normal distribution with known mean, and as a prior on positive scale parameters more generally.
Parameters
Notes
Probability density on :
Moments (when defined):
Mode: .
Conjugacy: with a likelihood and known mean , the posterior over is again Inverse-Gamma with updated parameters , .
Because Lucid's lucid.distributions.Gamma sampler is
rejection-based, has_rsample is False here and
sample returns detached samples obtained by reciprocating
a Gamma draw.
Examples
>>> import lucid
>>> from lucid.distributions import InverseGamma
>>> d = InverseGamma(concentration=3.0, rate=2.0)
>>> d.mean # β / (α - 1) = 1.0
Tensor(1.0)
>>> d.sample((4,))
Tensor([...])Used by 1
Constructors
1dunder
__init__
→None__init__(concentration: Tensor | float, rate: Tensor | float, validate_args: bool | None = None)Properties
2Instance methods
3α + log β + log Γ(α) − (1 + α) · ψ(α).
Sample by taking the reciprocal of a Gamma sample.