Skip to content

Commit 6cb7a6b

Browse files
Remove tests for random variable samples shape and size
Most of the random variable logic has been moved to aesara, as well as most of the relative tests. More details can be found on issue pymc-devs#4554
1 parent 7fed128 commit 6cb7a6b

File tree

1 file changed

+1
-105
lines changed

1 file changed

+1
-105
lines changed

pymc3/tests/test_distributions_random.py

Lines changed: 1 addition & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,6 @@ class TestGaussianRandomWalk(BaseTestCases.BaseTestCase):
240240
default_shape = (1,)
241241

242242

243-
@pytest.mark.skip(reason="This test is covered by Aesara")
244-
class TestNormal(BaseTestCases.BaseTestCase):
245-
distribution = pm.Normal
246-
params = {"mu": 0.0, "tau": 1.0}
247-
248-
249243
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
250244
class TestTruncatedNormal(BaseTestCases.BaseTestCase):
251245
distribution = pm.TruncatedNormal
@@ -270,18 +264,6 @@ class TestSkewNormal(BaseTestCases.BaseTestCase):
270264
params = {"mu": 0.0, "sigma": 1.0, "alpha": 5.0}
271265

272266

273-
@pytest.mark.skip(reason="This test is covered by Aesara")
274-
class TestHalfNormal(BaseTestCases.BaseTestCase):
275-
distribution = pm.HalfNormal
276-
params = {"tau": 1.0}
277-
278-
279-
@pytest.mark.skip(reason="This test is covered by Aesara")
280-
class TestUniform(BaseTestCases.BaseTestCase):
281-
distribution = pm.Uniform
282-
params = {"lower": 0.0, "upper": 1.0}
283-
284-
285267
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
286268
class TestTriangular(BaseTestCases.BaseTestCase):
287269
distribution = pm.Triangular
@@ -305,12 +287,6 @@ class TestKumaraswamy(BaseTestCases.BaseTestCase):
305287
params = {"a": 1.0, "b": 1.0}
306288

307289

308-
@pytest.mark.skip(reason="This test is covered by Aesara")
309-
class TestExponential(BaseTestCases.BaseTestCase):
310-
distribution = pm.Exponential
311-
params = {"lam": 1.0}
312-
313-
314290
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
315291
class TestLaplace(BaseTestCases.BaseTestCase):
316292
distribution = pm.Laplace
@@ -335,30 +311,6 @@ class TestStudentT(BaseTestCases.BaseTestCase):
335311
params = {"nu": 5.0, "mu": 0.0, "lam": 1.0}
336312

337313

338-
@pytest.mark.skip(reason="This test is covered by Aesara")
339-
class TestCauchy(BaseTestCases.BaseTestCase):
340-
distribution = pm.Cauchy
341-
params = {"alpha": 1.0, "beta": 1.0}
342-
343-
344-
@pytest.mark.skip(reason="This test is covered by Aesara")
345-
class TestHalfCauchy(BaseTestCases.BaseTestCase):
346-
distribution = pm.HalfCauchy
347-
params = {"beta": 1.0}
348-
349-
350-
@pytest.mark.skip(reason="This test is covered by Aesara")
351-
class TestGamma(BaseTestCases.BaseTestCase):
352-
distribution = pm.Gamma
353-
params = {"alpha": 1.0, "beta": 1.0}
354-
355-
356-
@pytest.mark.skip(reason="This test is covered by Aesara")
357-
class TestInverseGamma(BaseTestCases.BaseTestCase):
358-
distribution = pm.InverseGamma
359-
params = {"alpha": 0.5, "beta": 0.5}
360-
361-
362314
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
363315
class TestChiSquared(BaseTestCases.BaseTestCase):
364316
distribution = pm.ChiSquared
@@ -401,12 +353,6 @@ class TestLogitNormal(BaseTestCases.BaseTestCase):
401353
params = {"mu": 0.0, "sigma": 1.0}
402354

403355

404-
@pytest.mark.skip(reason="This test is covered by Aesara")
405-
class TestBinomial(BaseTestCases.BaseTestCase):
406-
distribution = pm.Binomial
407-
params = {"n": 5, "p": 0.5}
408-
409-
410356
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
411357
class TestBetaBinomial(BaseTestCases.BaseTestCase):
412358
distribution = pm.BetaBinomial
@@ -419,23 +365,12 @@ class TestBernoulli(BaseTestCases.BaseTestCase):
419365
params = {"p": 0.5}
420366

421367

368+
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
422369
class TestDiscreteWeibull(BaseTestCases.BaseTestCase):
423370
distribution = pm.DiscreteWeibull
424371
params = {"q": 0.25, "beta": 2.0}
425372

426373

427-
@pytest.mark.skip(reason="This test is covered by Aesara")
428-
class TestPoisson(BaseTestCases.BaseTestCase):
429-
distribution = pm.Poisson
430-
params = {"mu": 1.0}
431-
432-
433-
@pytest.mark.skip(reason="This test is covered by Aesara")
434-
class TestNegativeBinomial(BaseTestCases.BaseTestCase):
435-
distribution = pm.NegativeBinomial
436-
params = {"mu": 1.0, "alpha": 1.0}
437-
438-
439374
@pytest.mark.xfail(reason="This distribution has not been refactored for v4")
440375
class TestConstant(BaseTestCases.BaseTestCase):
441376
distribution = pm.Constant
@@ -484,45 +419,6 @@ class TestMoyal(BaseTestCases.BaseTestCase):
484419
params = {"mu": 0.0, "sigma": 1.0}
485420

486421

487-
@pytest.mark.skip(reason="This test is covered by Aesara")
488-
class TestCategorical(BaseTestCases.BaseTestCase):
489-
distribution = pm.Categorical
490-
params = {"p": np.ones(BaseTestCases.BaseTestCase.shape)}
491-
492-
def get_random_variable(
493-
self, shape, with_vector_params=False, **kwargs
494-
): # don't transform categories
495-
return super().get_random_variable(shape, with_vector_params=False, **kwargs)
496-
497-
def test_probability_vector_shape(self):
498-
"""Check that if a 2d array of probabilities are passed to categorical correct shape is returned"""
499-
p = np.ones((10, 5))
500-
assert pm.Categorical.dist(p=p).random().shape == (10,)
501-
assert pm.Categorical.dist(p=p).random(size=4).shape == (4, 10)
502-
p = np.ones((3, 7, 5))
503-
assert pm.Categorical.dist(p=p).random().shape == (3, 7)
504-
assert pm.Categorical.dist(p=p).random(size=4).shape == (4, 3, 7)
505-
506-
507-
@pytest.mark.skip(reason="This test is covered by Aesara")
508-
class TestDirichlet(SeededTest):
509-
@pytest.mark.parametrize(
510-
"shape, size",
511-
[
512-
((2), (1)),
513-
((2), (2)),
514-
((2, 2), (2, 100)),
515-
((3, 4), (3, 4)),
516-
((3, 4), (3, 4, 100)),
517-
((3, 4), (100)),
518-
((3, 4), (1)),
519-
],
520-
)
521-
def test_dirichlet_random_shape(self, shape, size):
522-
out_shape = to_tuple(size) + to_tuple(shape)
523-
assert pm.Dirichlet.dist(a=np.ones(shape)).random(size=size).shape == out_shape
524-
525-
526422
class TestCorrectParametrizationMappingPymcToScipy(SeededTest):
527423
@staticmethod
528424
def get_inputs_from_apply_node_outputs(outputs):

0 commit comments

Comments
 (0)