Description
Hey PyMC & @jessegrabowski
I’m trying to use state space’s forecast method with exogenous variables, but I keep getting this error:
ValueError: conflicting sizes for dimension ‘time’: length 1107 on the data but length 8 on coordinate ‘time’
My scenario: I’m passing exogenous indicator variables totaling 18 columns and 8 rows long, for an 8 day forecast. The period I’m forecasting is not at the -very- end of my time series. I’m testing my exogenous variable’s ability to reduce variance on events and holidays.
Time series info:
Length: 1107 data points
Start: 2022-01-19
End: 2025-01-29
Relevant code:
// Define start date and forecast period
start_date, n_periods = pd.to_datetime("2024-1-25"), 8
// Extract exogenous indicator variables for the forecast period
scenario = {'data_exog': pd.DataFrame(df_holidays.loc[start_date:].iloc[:n_periods].to_numpy(dtype=float),
columns=df_holidays.columns)}
// Generate the forecast
forecasts = ss_mod.forecast(trace, start=start_date, periods=n_periods, scenario=scenario)
My second line of code is extracting the relevant portion of my exogenous variables and assigning it to the scenario.
Am I getting this error because I’m not forecasting at the very end of my time series? (edit: dumb question, I’ll test this later.)
Conda Environment-
PyMC Version: 5.20.1
PyMC Extras Version: 0.2.3
Python Version: Python 3.11.11
Thanks,
Roy