Skip to content

Commit 084bfd7

Browse files
committed
Implement InverseGamma based on numpy
1 parent e25e8a2 commit 084bfd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pytensor/tensor/random/basic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ def rng_fn_scipy(cls, rng, loc, scale, size):
12191219
halfcauchy = HalfCauchyRV()
12201220

12211221

1222-
class InvGammaRV(ScipyRandomVariable):
1222+
class InvGammaRV(RandomVariable):
12231223
r"""An inverse-gamma continuous random variable.
12241224
12251225
The probability density function for `invgamma` in terms of its shape
@@ -1266,8 +1266,8 @@ def __call__(self, shape, scale, size=None, **kwargs):
12661266
return super().__call__(shape, scale, size=size, **kwargs)
12671267

12681268
@classmethod
1269-
def rng_fn_scipy(cls, rng, shape, scale, size):
1270-
return stats.invgamma.rvs(shape, scale=scale, size=size, random_state=rng)
1269+
def rng_fn(cls, rng, shape, scale, size):
1270+
return 1 / rng.gamma(shape, 1 / scale, size)
12711271

12721272

12731273
invgamma = InvGammaRV()

0 commit comments

Comments
 (0)