提交 c3f2a8c3 authored 作者: Ricardo's avatar Ricardo 提交者: ricardoV94

Add LogNormalRV

上级 0cd9dfba
...@@ -74,6 +74,20 @@ class HalfNormalRV(RandomVariable): ...@@ -74,6 +74,20 @@ class HalfNormalRV(RandomVariable):
halfnormal = HalfNormalRV() halfnormal = HalfNormalRV()
class LogNormalRV(RandomVariable):
name = "lognormal"
ndim_supp = 0
ndims_params = [0, 0]
dtype = "floatX"
_print_name = ("LogN", "\\operatorname{LogN}")
def __call__(self, mean=0.0, sigma=1.0, size=None, **kwargs):
return super().__call__(mean, sigma, size=size, **kwargs)
lognormal = LogNormalRV()
class GammaRV(RandomVariable): class GammaRV(RandomVariable):
name = "gamma" name = "gamma"
ndim_supp = 0 ndim_supp = 0
......
...@@ -30,6 +30,7 @@ from aesara.tensor.random.basic import ( ...@@ -30,6 +30,7 @@ from aesara.tensor.random.basic import (
hypergeometric, hypergeometric,
invgamma, invgamma,
laplace, laplace,
lognormal,
multinomial, multinomial,
multivariate_normal, multivariate_normal,
nbinom, nbinom,
...@@ -213,6 +214,15 @@ def test_halfnormal_samples(): ...@@ -213,6 +214,15 @@ def test_halfnormal_samples():
) )
def test_lognormal_samples():
test_mean = np.array(0, dtype=config.floatX)
test_sigma = np.array(1, dtype=config.floatX)
rv_numpy_tester(lognormal)
rv_numpy_tester(lognormal, test_mean)
rv_numpy_tester(lognormal, test_mean, test_sigma, size=[2, 3])
def test_gamma_samples(): def test_gamma_samples():
test_a = np.array(0.5, dtype=config.floatX) test_a = np.array(0.5, dtype=config.floatX)
test_b = np.array(0.5, dtype=config.floatX) test_b = np.array(0.5, dtype=config.floatX)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论