Skip to content

Commit 637ced4

Browse files
committed
Remove NoDistribution class
1 parent 49eb0ac commit 637ced4

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

pymc/distributions/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
DensityDist,
8282
Discrete,
8383
Distribution,
84-
NoDistribution,
8584
SymbolicRandomVariable,
8685
)
8786
from pymc.distributions.mixture import Mixture, NormalMixture
@@ -159,7 +158,6 @@
159158
"SymbolicRandomVariable",
160159
"Continuous",
161160
"Discrete",
162-
"NoDistribution",
163161
"MvNormal",
164162
"MatrixNormal",
165163
"KroneckerNormal",

pymc/distributions/distribution.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
"Distribution",
6363
"Continuous",
6464
"Discrete",
65-
"NoDistribution",
6665
"SymbolicRandomVariable",
6766
]
6867

@@ -470,13 +469,6 @@ class Continuous(Distribution):
470469
"""Base class for continuous distributions"""
471470

472471

473-
class NoDistribution(Distribution):
474-
"""Base class for artifical distributions
475-
476-
RandomVariables that share this type are allowed in logprob graphs
477-
"""
478-
479-
480472
class DensityDistRV(RandomVariable):
481473
"""
482474
Base class for DensityDistRV
@@ -494,7 +486,7 @@ def rng_fn(cls, rng, *args):
494486
return cls._random_fn(*args, rng=rng, size=size)
495487

496488

497-
class DensityDist(NoDistribution):
489+
class DensityDist(Distribution):
498490
"""A distribution that can be used to wrap black-box log density functions.
499491
500492
Creates a Distribution and registers the supplied log density function to be used

pymc/distributions/simulator.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from scipy.spatial import cKDTree
2626

2727
from pymc.aesaraf import floatX
28-
from pymc.distributions.distribution import NoDistribution, _moment
28+
from pymc.distributions.distribution import Distribution, _moment
2929

3030
__all__ = ["Simulator"]
3131

@@ -63,7 +63,7 @@ def sum_stat(cls, *args, **kwargs):
6363
return cls._sum_stat(*args, **kwargs)
6464

6565

66-
class Simulator(NoDistribution):
66+
class Simulator(Distribution):
6767
r"""
6868
Simulator distribution, used for Approximate Bayesian Inference (ABC)
6969
with Sequential Monte Carlo (SMC) sampling via :func:`~pymc.sample_smc`.
@@ -213,11 +213,8 @@ def __new__(
213213
)()
214214

215215
# The logp function is registered to the more general SimulatorRV,
216-
# in order to avoid issues with multiprocessing / pickling
217-
218-
# rv_type = type(sim_op)
219-
# NoDistribution.register(rv_type)
220-
NoDistribution.register(SimulatorRV)
216+
# in order to avoid issues with multiprocessing / pickling,
217+
# otherwise it would be registered to `type(sim_op)`
221218

222219
@_logprob.register(SimulatorRV)
223220
def logp(op, value_var_list, *dist_params, **kwargs):

pymc/gp/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
from pymc.aesaraf import compile_pymc, walk_model
3030

3131
# Avoid circular dependency when importing modelcontext
32-
from pymc.distributions.distribution import NoDistribution
32+
from pymc.distributions.distribution import Distribution
3333

34-
assert NoDistribution # keep both pylint and black happy
34+
assert Distribution # keep both pylint and black happy
3535
from pymc.model import modelcontext
3636

3737
JITTER_DEFAULT = 1e-6

pymc/tests/distributions/test_distribution.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ def test_all_distributions_have_moments():
102102
dist_module.Distribution,
103103
dist_module.Discrete,
104104
dist_module.Continuous,
105-
dist_module.NoDistribution,
106105
dist_module.DensityDist,
107106
dist_module.simulator.Simulator,
108107
}

0 commit comments

Comments
 (0)