Skip to content

BUG: constant_data is missing from idata when sampling with nutpie #74

Open
@Y0dler

Description

@Y0dler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions