@@ -50,7 +50,7 @@ def polyagamma_cdf(*args, **kwargs):
50
50
from aesara .graph .basic import ancestors
51
51
from aesara .tensor .random .op import RandomVariable
52
52
from aesara .tensor .var import TensorVariable
53
- from numpy import array , inf , log
53
+ from numpy import array , inf
54
54
from numpy .testing import assert_almost_equal , assert_equal
55
55
from scipy import integrate
56
56
from scipy .special import erf , gammaln , logit
@@ -71,7 +71,6 @@ def polyagamma_cdf(*args, **kwargs):
71
71
Cauchy ,
72
72
ChiSquared ,
73
73
Constant ,
74
- DensityDist ,
75
74
Dirichlet ,
76
75
DirichletMultinomial ,
77
76
DiscreteUniform ,
@@ -963,25 +962,6 @@ def check_selfconsistency_discrete_logcdf(
963
962
err_msg = str (pt ),
964
963
)
965
964
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
-
985
965
def test_uniform (self ):
986
966
self .check_logp (
987
967
Uniform ,
@@ -1664,15 +1644,6 @@ def test_binomial(self):
1664
1644
{"n" : NatSmall , "p" : Unit },
1665
1645
)
1666
1646
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
-
1676
1647
def test_beta_binomial (self ):
1677
1648
self .check_logp (
1678
1649
BetaBinomial ,
@@ -1771,18 +1742,6 @@ def test_poisson(self):
1771
1742
def test_constantdist (self ):
1772
1743
self .check_logp (Constant , I , {"c" : I }, lambda value , c : np .log (c == value ))
1773
1744
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
-
1786
1745
def test_zeroinflatedpoisson (self ):
1787
1746
def logp_fn (value , psi , theta ):
1788
1747
if value == 0 :
@@ -1813,18 +1772,6 @@ def logcdf_fn(value, psi, theta):
1813
1772
{"theta" : Rplus , "psi" : Unit },
1814
1773
)
1815
1774
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
-
1828
1775
def test_zeroinflatednegativebinomial (self ):
1829
1776
def logp_fn (value , psi , mu , alpha ):
1830
1777
n , p = NegativeBinomial .get_n_p (mu = mu , alpha = alpha )
@@ -1873,14 +1820,6 @@ def logcdf_fn(value, psi, mu, alpha):
1873
1820
{"psi" : Unit , "mu" : Rplusbig , "alpha" : Rplusbig },
1874
1821
)
1875
1822
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
-
1884
1823
def test_zeroinflatedbinomial (self ):
1885
1824
def logp_fn (value , psi , n , p ):
1886
1825
if value == 0 :
@@ -2377,13 +2316,6 @@ def test_orderedprobit(self, n):
2377
2316
lambda value , eta , cutpoints : orderedprobit_logpdf (value , eta , cutpoints ),
2378
2317
)
2379
2318
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
-
2387
2319
def test_get_tau_sigma (self ):
2388
2320
sigma = np .array (2 )
2389
2321
assert_almost_equal (get_tau_sigma (sigma = sigma ), [1.0 / sigma ** 2 , sigma ])
0 commit comments