pymc.dims does not impute missing (NaN) observed data
Open
Nobody has claimed this yet.
dims
feature request
- Dominant language
- Python
- Stars
- 9.8k
- Forks
- 2.3k
- Avg merge
- 21h 39m
- Merged PRs (30d)
- 5
Description
Unlike pm.Normal, a pymc.dims distribution given an observed DataArray containing NaNs builds the model but returns a non-finite logp instead of creating an imputation RV for the missing entries.
import numpy as np
import xarray as xr
import pymc as pm
import pymc.dims as pmd
Y = xr.DataArray([[1.0, 2.0], [np.nan, 3.0]], dims=("a", "b"))
with pm.Model(coords={"a": [0, 1], "b": [0, 1]}) as m:
a = pmd.Normal("a", 0, 1, dims="a")
pmd.Normal("obs", a, 1.0, observed=Y, dims=("a", "b"))
m.compile_logp()(m.initial_point()) # nan
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pymc.dims Normal distribution path when an observed DataArray contains NaNs, using the provided model and pmd.Normal calls as the reproducer. Confirm that missing entries create an imputation RV and that m.compile_logp()(m.initial_point()) returns a finite value for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100