You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior predictive sampling draws values from the untransformed variables and then attempts to recreate the transformed values via transformation.forward_val(untransformed_values)
However, this logic is not sufficient to recover the correct values when there are stochastic bounds (e.g., pm.Uniform('x', lower=0, upper=y), because we also need to know what the values of the stochastic bounds were in each sample (i.e., the y).
People don't usually care about transformed variables, but this is critical for example in sample_smc() as it creates it's particles from an initial prior_predictive call.
Hopefully this will be gone in V4.0, but I thought best to document it just in case (and in the meanwhile).
/home/ricardo/Documents/Projects/pymc3/pymc3/distributions/transforms.py:294: RuntimeWarning: invalid value encountered in log
return floatX(np.log(x - a) - np.log(b - x))
0.314
The 31.4% NANs correspond to cases where a and b were either above or below x due to random sampling in the block below. The NANs are the most obvious symptom, but all values are in fact incorrect:
ricardoV94
changed the title
invalid logic in sample prior predictive for auto-transformed variables
Invalid logic in sample prior predictive for transformed variables
Feb 23, 2021
Prior predictive sampling draws values from the untransformed variables and then attempts to recreate the transformed values via
transformation.forward_val(untransformed_values)
However, this logic is not sufficient to recover the correct values when there are stochastic bounds (e.g.,
pm.Uniform('x', lower=0, upper=y)
, because we also need to know what the values of the stochastic bounds were in each sample (i.e., they
).People don't usually care about transformed variables, but this is critical for example in
sample_smc()
as it creates it's particles from an initial prior_predictive call.Hopefully this will be gone in V4.0, but I thought best to document it just in case (and in the meanwhile).
Minimal reproducible example:
The 31.4%
NANs
correspond to cases wherea
andb
were either above or below x due to random sampling in the block below. TheNANs
are the most obvious symptom, but all values are in fact incorrect:https://github.com/pymc-devs/pymc3/blob/32b5c941c8f43b485afd3da1ae5544c3c50b9e77/pymc3/distributions/transforms.py#L289-L294
Which is called at the end of
prior_predictive_sampling
, without providing apoint
or any other contextual info:https://github.com/pymc-devs/pymc3/blob/37ca5ea9b25aa00ed4d460f0fb417712d125d248/pymc3/sampling.py#L1941-L1957
The text was updated successfully, but these errors were encountered: