Skip to content

BUG: Missing check for collision between coord name and data variable name #7788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
drbenvincent opened this issue May 17, 2025 · 0 comments
Labels

Comments

@drbenvincent
Copy link

drbenvincent commented May 17, 2025

Describe the issue:

There is a bug where it is possible to define a coord name which is also the same name as a data variable. So we are missing a check for name collisions. This leads to easy to miss downstream errors.

Reproduceable code example:

import pymc as pm


with pm.Model(coords={"a": [0, 1]}) as m:
    a = pm.Data("a", [5, 10])
    b = pm.Normal("b", dims="a")

Error message:

Code snippet above should raise an exception, but does not.

PyMC version information:

pymc version: 5.22.0

Context for the issue:

The issue first showed up as a) correct sampling of random variables with pm.sample, b) re-sampling of random variables when calling pm.sample_posterior_predictive. So what was being returned was actually prior predictive samples, not posterior predictive samples. @ricardoV94 helped me track down that it was caused by a common label for a coord and a data node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant