Closed
Description
I’m looking to do imputation of partially observed random variables with positive support. Attempting to do so results in sampling values outside the support of the distribution and causes various downstream steps to fail, e.g., finding the MAP and variational inference.
import pymc3 as pm
from numpy.ma import masked_values
MASK_VALUE = -999.
observed_values = np.array([1., MASK_VALUE], dtype=float)
with pm.Model() as model:
pm.Gamma("partially_observed", alpha=3., beta=1/0.1, observed=masked_values(observed_values, value=MASK_VALUE))
map_estimate = pm.find_MAP()
print(map_estimate)
print(model.test_point)
{'partially_observed_missing': array([-0.7])}
{'partially_observed_missing': array([0.3])}
I originally raised this on the PyMC3 Discourse (https://discourse.pymc.io/t/imputation-for-partially-observed-random-variables-with-positive-support/6844) and @ckrapu suggested that I create an issue.
Versions and main components
- PyMC3 Version: '3.9.3'
- Theano Version: '1.0.5' (not sure if this is the correct version as things are somewhat confusing with having Theano, Theano-PyMC, and Aesara all co-existing)
- Python Version: 3.6.12
- Operating system: Linux
- How did you install PyMC3: pip
Thanks for all the great work and for your help with resolving the issue!