Skip to content

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

Open
@drbenvincent

Description

@drbenvincent

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions