提交 084bfd75 authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Implement InverseGamma based on numpy

上级 e25e8a2a
...@@ -1219,7 +1219,7 @@ class HalfCauchyRV(ScipyRandomVariable): ...@@ -1219,7 +1219,7 @@ class HalfCauchyRV(ScipyRandomVariable):
halfcauchy = HalfCauchyRV() halfcauchy = HalfCauchyRV()
class InvGammaRV(ScipyRandomVariable): class InvGammaRV(RandomVariable):
r"""An inverse-gamma continuous random variable. r"""An inverse-gamma continuous random variable.
The probability density function for `invgamma` in terms of its shape The probability density function for `invgamma` in terms of its shape
...@@ -1266,8 +1266,8 @@ class InvGammaRV(ScipyRandomVariable): ...@@ -1266,8 +1266,8 @@ class InvGammaRV(ScipyRandomVariable):
return super().__call__(shape, scale, size=size, **kwargs) return super().__call__(shape, scale, size=size, **kwargs)
@classmethod @classmethod
def rng_fn_scipy(cls, rng, shape, scale, size): def rng_fn(cls, rng, shape, scale, size):
return stats.invgamma.rvs(shape, scale=scale, size=size, random_state=rng) return 1 / rng.gamma(shape, 1 / scale, size)
invgamma = InvGammaRV() invgamma = InvGammaRV()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论