提交 0cb9fea4 authored 作者: Ricardo's avatar Ricardo 提交者: ricardoV94

Add GeometricRV

上级 01020a18
...@@ -257,6 +257,17 @@ class PoissonRV(RandomVariable): ...@@ -257,6 +257,17 @@ class PoissonRV(RandomVariable):
poisson = PoissonRV() poisson = PoissonRV()
class GeometricRV(RandomVariable):
name = "geometric"
ndim_supp = 0
ndims_params = [0]
dtype = "int64"
_print_name = ("Geom", "\\operatorname{Geom}")
geometric = GeometricRV()
class CauchyRV(RandomVariable): class CauchyRV(RandomVariable):
name = "cauchy" name = "cauchy"
ndim_supp = 0 ndim_supp = 0
......
...@@ -23,6 +23,7 @@ from aesara.tensor.random.basic import ( ...@@ -23,6 +23,7 @@ from aesara.tensor.random.basic import (
dirichlet, dirichlet,
exponential, exponential,
gamma, gamma,
geometric,
gumbel, gumbel,
halfcauchy, halfcauchy,
halfnormal, halfnormal,
...@@ -442,6 +443,13 @@ def test_poisson_samples(): ...@@ -442,6 +443,13 @@ def test_poisson_samples():
rv_numpy_tester(poisson, test_lambda, size=[2, 3]) rv_numpy_tester(poisson, test_lambda, size=[2, 3])
def test_geometric_samples():
test_p = np.array(0.1, dtype=config.floatX)
rv_numpy_tester(geometric, test_p)
rv_numpy_tester(geometric, test_p, size=[2, 3])
def test_cauchy_samples(): def test_cauchy_samples():
rv_numpy_tester(cauchy, test_fn=stats.cauchy.rvs) rv_numpy_tester(cauchy, test_fn=stats.cauchy.rvs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论