pymc-devs / pymc-examples

Examples of PyMC models, including a library of Jupyter notebooks.
https://www.pymc.io/projects/examples/en/latest/
MIT License
259 stars 212 forks source link

Error in Forecasting_with_structural_timeseries (too many indices for array) #532

Open bitsnaps opened 1 year ago

bitsnaps commented 1 year ago

Forecasting with Structural AR Timeseries

Issue description

Executing step by step each cell I got: too many indices for array at line:

IndexError                                Traceback (most recent call last)
<ipython-input-13-fc80453dcf5f> in <module>
     15         sigma=sigma,
     16         constant=True,
---> 17         dims="obs_id_fut_1",
     18     )
     19     yhat_fut = pm.Normal("yhat_fut", mu=ar1_fut[1:], sigma=sigma, dims="obs_id_fut")

Note: I'm not sure if the bug is related to pymc it self or the example, I can't find a way to verify that.

Expected output (according to the doc)

Sampling: [ar1_fut, likelihood, yhat_fut]

 100.00% [8000/8000 00:31<00:00]

Additional info:

Execution environment:

Proposed solution

Probably reducing dimension.

OriolAbril commented 1 year ago

What pymc version are you using? Can you also provide versions for all libraries listed in https://www.pymc.io/projects/examples/en/latest/time_series/Forecasting_with_structural_timeseries.html#watermark?

bitsnaps commented 1 year ago

Is it compatible with these versions ?

pymc                                     4.1.4
pytensor                                 2.9.1
aeppl                                    0.0.33
xarray                                   0.20.2
arviz                                    0.12.1
numpy                                    1.21.6
pandas                                   1.3.4
sys                                   3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 14:38:56) 
[Clang 4.0.1 (tags/RELEASE_401/final)]