def make_lognormal(kwargs): kwargs['examples'] = [kwargs.pop('example')] return Fixture(pyro_dist=(dist.lognormal, LogNormal), scipy_dist=sp.lognorm, scipy_arg_fn=lambda mu, sigma: ((np.array(sigma),), {"scale": np.exp(np.array(mu))}), **kwargs)
def lognormal(): return Fixture(pyro_dist=(dist.lognormal, LogNormal), scipy_dist=sp.lognorm, examples=[ { 'mu': [1.4], 'sigma': [0.4], 'test_data': [5.5] }, ], scipy_arg_fn=lambda mu, sigma: ((np.array(sigma), ), { "scale": np.exp(np.array(mu)) }))
continuous_dists = [ Fixture( pyro_dist=dist.Uniform, scipy_dist=sp.uniform, examples=[ { "low": [2.0], "high": [2.5], "test_data": [2.2] }, { "low": [2.0, 4.0], "high": [3.0, 5.0], "test_data": [[[2.5, 4.5]], [[2.5, 4.5]], [[2.5, 4.5]]], }, { "low": [[2.0], [-3.0], [0.0]], "high": [[2.5], [0.0], [1.0]], "test_data": [[2.2], [-2], [0.7]], }, ], scipy_arg_fn=lambda low, high: ( (), { "loc": np.array(low), "scale": np.array(high) - np.array(low) }, ), ), Fixture( pyro_dist=dist.Exponential,
super().__init__(dist.Normal(loc, scale)) continuous_dists = [ Fixture(pyro_dist=dist.Uniform, scipy_dist=sp.uniform, examples=[ { 'low': [2.], 'high': [2.5], 'test_data': [2.2] }, { 'low': [2., 4.], 'high': [3., 5.], 'test_data': [[[2.5, 4.5]], [[2.5, 4.5]], [[2.5, 4.5]]] }, { 'low': [[2.], [-3.], [0.]], 'high': [[2.5], [0.], [1.]], 'test_data': [[2.2], [-2], [0.7]] }, ], scipy_arg_fn=lambda low, high: ( (), { "loc": np.array(low), "scale": np.array(high) - np.array(low) })), Fixture(pyro_dist=dist.Exponential, scipy_dist=sp.expon, examples=[ {
import scipy.stats as sp import pyro.distributions as dist from pyro.distributions.testing.naive_dirichlet import NaiveBeta, NaiveDirichlet from pyro.distributions.testing.rejection_exponential import RejectionExponential from pyro.distributions.testing.rejection_gamma import ShapeAugmentedBeta, ShapeAugmentedDirichlet, ShapeAugmentedGamma from tests.distributions.dist_fixture import Fixture continuous_dists = [ Fixture(pyro_dist=dist.Uniform, scipy_dist=sp.uniform, examples=[ {'low': [2.], 'high': [2.5], 'test_data': [2.2]}, {'low': [2., 4.], 'high': [3., 5.], 'test_data': [[[2.5, 4.5]], [[2.5, 4.5]], [[2.5, 4.5]]]}, {'low': [[2.], [-3.], [0.]], 'high': [[2.5], [0.], [1.]], 'test_data': [[2.2], [-2], [0.7]]}, ], scipy_arg_fn=lambda low, high: ((), {"loc": np.array(low), "scale": np.array(high) - np.array(low)})), Fixture(pyro_dist=dist.Exponential, scipy_dist=sp.expon, examples=[ {'rate': [2.4], 'test_data': [5.5]}, {'rate': [2.4, 5.5], 'test_data': [[[5.5, 3.2]], [[5.5, 3.2]], [[5.5, 3.2]]]}, {'rate': [[2.4, 5.5]], 'test_data': [[[5.5, 3.2]], [[5.5, 3.2]], [[5.5, 3.2]]]},
import scipy.stats as sp import pyro.distributions as dist from pyro.distributions import (Bernoulli, Beta, Binomial, Categorical, Cauchy, Dirichlet, Exponential, Gamma, HalfCauchy, LogNormal, Multinomial, MultivariateNormal, Normal, OneHotCategorical, Poisson, Uniform) from tests.distributions.dist_fixture import Fixture continuous_dists = [ Fixture(pyro_dist=(dist.uniform, Uniform), scipy_dist=sp.uniform, examples=[ {'a': [2], 'b': [2.5], 'test_data': [2.2]}, {'a': [2, 4], 'b': [3, 5], 'test_data': [[[2.5, 4.5]], [[2.5, 4.5]], [[2.5, 4.5]]]}, {'a': [[2], [-3], [0]], 'b': [[2.5], [0], [1]], 'test_data': [[2.2], [-2], [0.7]]}, ], scipy_arg_fn=lambda a, b: ((), {"loc": np.array(a), "scale": np.array(b) - np.array(a)})), Fixture(pyro_dist=(dist.exponential, Exponential), scipy_dist=sp.expon, examples=[ {'lam': [2.4], 'test_data': [5.5]}, {'lam': [2.4, 5.5], 'test_data': [[[5.5, 3.2]], [[5.5, 3.2]], [[5.5, 3.2]]]}, {'lam': [[2.4, 5.5]], 'test_data': [[[5.5, 3.2]], [[5.5, 3.2]], [[5.5, 3.2]]]},
Uniform) from tests.distributions.dist_fixture import Fixture continuous_dists = [ Fixture(pyro_dist=(dist.uniform, Uniform), scipy_dist=sp.uniform, examples=[ { 'a': [2], 'b': [2.5], 'test_data': [2.2] }, { 'a': [2, 4], 'b': [3, 5], 'test_data': [[[2.5, 4.5]], [[2.5, 4.5]], [[2.5, 4.5]]] }, { 'a': [[2], [-3], [0]], 'b': [[2.5], [0], [1]], 'test_data': [[2.2], [-2], [0.7]] }, ], scipy_arg_fn=lambda a, b: ((), { "loc": np.array(a), "scale": np.array(b) - np.array(a) })), Fixture(pyro_dist=(dist.exponential, Exponential), scipy_dist=sp.expon, examples=[ {