BUG: constant_data is missing from idata when sampling with nutpie
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 207
- Forks
- 28
- Avg merge
- 7d 21h
- Merged PRs (30d)
- 1
Description
Describe the issue:
I recently encountered an issue when trying to add constant data to some of my models.
When sampling with nuts_sampler="pymc", idata contains a group denominated as constant_data where x and y from this toy example are stored. Unfortunately, when using nutpie, the constant data is nowhere to be found.
Is this actually a bug or is there something wrong with my definitions? Or are pm.ConstantData() and such perhaps just not supported when using nutpie?
Any help would be much appreciated.
Reproduceable code example:
import numpy as np
import pymc as pm
import pytensor.tensor as pt
x = np.array([1,2,3,4])
y = np.array([100, 190, 310, 405])
with pm.Model() as pmodel:
# add data to the pmodel as ConstantData
pm.ConstantData("x", x)
pm.ConstantData("y", y)
var = pm.Normal("var", 100, 5)
# likelihood
pm.Normal("L", mu=y, sigma=0.1, observed=y)
# posterior
pst = x * var
pst = pm.Deterministic("posterior", pst)
# sampling
idata = pm.sample(nuts_sampler="nutpie", tune=50, draws=50)
print(idata)
Error message:
Output of print(idata):
Inference data with groups:
> posterior
> sample_stats
Warmup iterations saved (warmup_*).
PyMC version information:
PyMC v5.8.1 (pypi)
nutpie v0.9.1 (pypi)
PyTensor v2.16.2 (pypi)
Context for the issue:
No response
Contributor guide
No contributing guide indexed for this repository
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 provided reproducible model and compare the idata groups produced by nuts_sampler="pymc" and nuts_sampler="nutpie". Investigate how pm.ConstantData() is represented during nutpie sampling; done means the nutpie result includes the expected constant_data group containing x and y.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100