Skip to content
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

Inconsistent auto generated dimension names in numpy_to_data_array #2397

Open
lucianopaz opened this issue Nov 14, 2024 · 0 comments
Open

Inconsistent auto generated dimension names in numpy_to_data_array #2397

lucianopaz opened this issue Nov 14, 2024 · 0 comments

Comments

@lucianopaz
Copy link
Contributor

Describe the bug
This was originally reported in pymc-devs/pymc#7572. The problem is that arviz.data.numpy_to_data_array does not yield consistent dimension names when there are default_dims and dims that also match some of these.

To Reproduce

import numpy as np
from arviz.data import numpy_to_data_array

generated_dims = []
for dims in [None, ["chain", "draw"], ["chain", "draw", None]]:
    out_dims = numpy_to_data_array(
        np.empty((4, 500, 7)),
        var_name="a",
        dims=dims,
        default_dims=["chain", "draw"]
    ).dims
    generated_dims.append(out_dims)

assert all(dims == generated_dims[0] for dims in generated_dims)

Specifically:

>>> generated_dims
[('chain', 'draw', 'a_dim_0'),
 ('chain', 'draw', 'a_dim_2'),
 ('chain', 'draw', 'a_dim_2')]

Expected behavior
The result that one gets when dims = None should be the same as when the chain and draw dimension are also specified.

Additional context
Current arviz main

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

No branches or pull requests

1 participant