-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
In a lot of distributions we have a call to assert_negative_support
which in V4 is not doing anything because we are not using the output anywhere:
pymc/pymc/distributions/continuous.py
Lines 200 to 203 in bdd4d19
def assert_negative_support(var, label, distname, value=-1e-6): | |
msg = f"The variable specified for {label} has negative support for {distname}, " | |
msg += "likely making it unsuitable for this parameter." | |
return Assert(msg)(var, at.all(at.ge(var, 0.0))) |
pymc/pymc/distributions/continuous.py
Lines 841 to 851 in bdd4d19
@classmethod | |
def dist(cls, sigma=None, tau=None, sd=None, *args, **kwargs): | |
if sd is not None: | |
sigma = sd | |
tau, sigma = get_tau_sigma(tau=tau, sigma=sigma) | |
assert_negative_support(tau, "tau", "HalfNormal") | |
assert_negative_support(sigma, "sigma", "HalfNormal") | |
return super().dist([0.0, sigma], **kwargs) |
But we might not want to use this as is, see aesara-devs/aeppl#84
In V3 it seems this was doing some hackish test:
pymc/pymc3/distributions/continuous.py
Lines 120 to 138 in c332f8c
def assert_negative_support(var, label, distname, value=-1e-6): | |
# Checks for evidence of positive support for a variable | |
if var is None: | |
return | |
try: | |
# Transformed distribution | |
support = np.isfinite(var.transformed.distribution.dist.logp(value).tag.test_value) | |
except AttributeError: | |
try: | |
# Untransformed distribution | |
support = np.isfinite(var.distribution.logp(value).tag.test_value) | |
except AttributeError: | |
# Otherwise no direct evidence of non-positive support | |
support = False | |
if np.any(support): | |
msg = f"The variable specified for {label} has negative support for {distname}, " | |
msg += "likely making it unsuitable for this parameter." | |
warnings.warn(msg) |
Should we just remove the call? If we want to do the kind of V3 check era we should probably do it properly by adding domain information to the RandomVariables instead of doing the -1e-6 logp test.