pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Reasses dims without coords

Open ricardoV94 opened this issue 2 years ago • 1 comments

Description

It is currently possible to create dims without coords via pm.Data:

import pymc as pm

with pm.Model() as m:
  x = pm.MutableData("x", [0, 1, 2], dims=("dim_without_coord",))
  y = pm.Normal("y", x.sum(), dims=("dim_without_coord",))

We used to allow this also from RVs in the past but reverted in https://github.com/pymc-devs/pymc/pull/6112 I don't see a fundamental difference between the two cases, and in that PR I just missed this.

I would suggest we remove this functionality because it adds quite some complexity in the Model class, including fancy checks to see if a Data variable defined from dims without coords of another Data variable is being resized before the original one (but after is fine?): https://github.com/pymc-devs/pymc/blob/02cbac6592506a547117b2daa3f05847d16fe063/tests/model/test_core.py#L923-L937

(The unawareness) of this option has also led to bugs that were only patched recently: https://github.com/pymc-devs/pymc/pull/6882

ricardoV94 avatar Dec 04 '23 12:12 ricardoV94

This led to another bug in #7376

ricardoV94 avatar Jun 27 '24 11:06 ricardoV94