From e44a647be91a512070fe21ea66df9610ea4745d2 Mon Sep 17 00:00:00 2001 From: Till Hoffmann Date: Tue, 14 May 2024 11:46:40 -0400 Subject: [PATCH] Add entropy for `InverseGamma` distribution. --- numpyro/distributions/continuous.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/numpyro/distributions/continuous.py b/numpyro/distributions/continuous.py index 8280482c0..237cb633a 100644 --- a/numpyro/distributions/continuous.py +++ b/numpyro/distributions/continuous.py @@ -703,6 +703,14 @@ def variance(self): def cdf(self, x): return 1 - self.base_dist.cdf(1 / x) + def entropy(self): + return ( + self.concentration + + jnp.log(self.rate) + + gammaln(self.concentration) + - (1 + self.concentration) * digamma(self.concentration) + ) + class Gompertz(Distribution): r"""Gompertz Distribution.