Skip to content

Commit b386ae5

Browse files
committed
Remove unused checkd tests
1 parent 7d070b2 commit b386ae5

File tree

1 file changed

+1
-69
lines changed

1 file changed

+1
-69
lines changed

pymc/tests/test_distributions.py

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def polyagamma_cdf(*args, **kwargs):
5050
from aesara.graph.basic import ancestors
5151
from aesara.tensor.random.op import RandomVariable
5252
from aesara.tensor.var import TensorVariable
53-
from numpy import array, inf, log
53+
from numpy import array, inf
5454
from numpy.testing import assert_almost_equal, assert_equal
5555
from scipy import integrate
5656
from scipy.special import erf, gammaln, logit
@@ -71,7 +71,6 @@ def polyagamma_cdf(*args, **kwargs):
7171
Cauchy,
7272
ChiSquared,
7373
Constant,
74-
DensityDist,
7574
Dirichlet,
7675
DirichletMultinomial,
7776
DiscreteUniform,
@@ -963,25 +962,6 @@ def check_selfconsistency_discrete_logcdf(
963962
err_msg=str(pt),
964963
)
965964

966-
def check_int_to_1(self, model, value, domain, paramdomains, n_samples=10):
967-
pdf = model.fastfn(exp(model.logpt))
968-
for pt in product(paramdomains, n_samples=n_samples):
969-
pt = Point(pt, value=value.tag.test_value, model=model)
970-
bij = DictToVarBijection(value, (), pt)
971-
pdfx = bij.mapf(pdf)
972-
area = integrate_nd(pdfx, domain, value.dshape, value.dtype)
973-
assert_almost_equal(area, 1, err_msg=str(pt))
974-
975-
def checkd(self, distfam, valuedomain, vardomains, checks=None, extra_args=None):
976-
if checks is None:
977-
checks = (self.check_int_to_1,)
978-
979-
if extra_args is None:
980-
extra_args = {}
981-
m = build_model(distfam, valuedomain, vardomains, extra_args=extra_args)
982-
for check in checks:
983-
check(m, m.named_vars["value"], valuedomain, vardomains)
984-
985965
def test_uniform(self):
986966
self.check_logp(
987967
Uniform,
@@ -1664,15 +1644,6 @@ def test_binomial(self):
16641644
{"n": NatSmall, "p": Unit},
16651645
)
16661646

1667-
@pytest.mark.xfail(reason="checkd tests have not been refactored")
1668-
@pytest.mark.skipif(condition=(aesara.config.floatX == "float32"), reason="Fails on float32")
1669-
def test_beta_binomial_distribution(self):
1670-
self.checkd(
1671-
BetaBinomial,
1672-
Nat,
1673-
{"alpha": Rplus, "beta": Rplus, "n": NatSmall},
1674-
)
1675-
16761647
def test_beta_binomial(self):
16771648
self.check_logp(
16781649
BetaBinomial,
@@ -1771,18 +1742,6 @@ def test_poisson(self):
17711742
def test_constantdist(self):
17721743
self.check_logp(Constant, I, {"c": I}, lambda value, c: np.log(c == value))
17731744

1774-
@pytest.mark.xfail(reason="Test has not been refactored")
1775-
@pytest.mark.skipif(
1776-
condition=(aesara.config.floatX == "float32"),
1777-
reason="Fails on float32 due to inf issues",
1778-
)
1779-
def test_zeroinflatedpoisson_distribution(self):
1780-
self.checkd(
1781-
ZeroInflatedPoisson,
1782-
Nat,
1783-
{"theta": Rplus, "psi": Unit},
1784-
)
1785-
17861745
def test_zeroinflatedpoisson(self):
17871746
def logp_fn(value, psi, theta):
17881747
if value == 0:
@@ -1813,18 +1772,6 @@ def logcdf_fn(value, psi, theta):
18131772
{"theta": Rplus, "psi": Unit},
18141773
)
18151774

1816-
@pytest.mark.xfail(reason="Test not refactored yet")
1817-
@pytest.mark.skipif(
1818-
condition=(aesara.config.floatX == "float32"),
1819-
reason="Fails on float32 due to inf issues",
1820-
)
1821-
def test_zeroinflatednegativebinomial_distribution(self):
1822-
self.checkd(
1823-
ZeroInflatedNegativeBinomial,
1824-
Nat,
1825-
{"mu": Rplusbig, "alpha": Rplusbig, "psi": Unit},
1826-
)
1827-
18281775
def test_zeroinflatednegativebinomial(self):
18291776
def logp_fn(value, psi, mu, alpha):
18301777
n, p = NegativeBinomial.get_n_p(mu=mu, alpha=alpha)
@@ -1873,14 +1820,6 @@ def logcdf_fn(value, psi, mu, alpha):
18731820
{"psi": Unit, "mu": Rplusbig, "alpha": Rplusbig},
18741821
)
18751822

1876-
@pytest.mark.xfail(reason="Test not refactored yet")
1877-
def test_zeroinflatedbinomial_distribution(self):
1878-
self.checkd(
1879-
ZeroInflatedBinomial,
1880-
Nat,
1881-
{"n": NatSmall, "p": Unit, "psi": Unit},
1882-
)
1883-
18841823
def test_zeroinflatedbinomial(self):
18851824
def logp_fn(value, psi, n, p):
18861825
if value == 0:
@@ -2377,13 +2316,6 @@ def test_orderedprobit(self, n):
23772316
lambda value, eta, cutpoints: orderedprobit_logpdf(value, eta, cutpoints),
23782317
)
23792318

2380-
@pytest.mark.xfail(reason="checkd tests have not been refactored")
2381-
def test_densitydist(self):
2382-
def logp(x):
2383-
return -log(2 * 0.5) - abs(x - 0.5) / 0.5
2384-
2385-
self.checkd(DensityDist, R, {}, extra_args={"logp": logp})
2386-
23872319
def test_get_tau_sigma(self):
23882320
sigma = np.array(2)
23892321
assert_almost_equal(get_tau_sigma(sigma=sigma), [1.0 / sigma ** 2, sigma])

0 commit comments

Comments
 (0)