Comments (6)
Oh man, yes you are right. Didn‘t think about that. Now it‘s working fine. Thanks for the fast and helpful response!
from statsforecast.
Hey @baniasbaabe, thanks for using statsforecast. The problem isn't the series lengths but the horizon of your intervals, it should either be 1 or match your forecasting horizon (12). In your example it says 2 but I'm pretty sure the error would be a mismatch between 7 (intervals' h) and 12 (forecast's h).
from statsforecast.
Oh okay, I guess this isn‘t the problem because the error will be raised when calling .fit(). So it doesn‘t care about the forecast horizon of the .predict() method. When the series are from the same length, the problem doesn‘t arise.
from statsforecast.
Can you include the full stacktrace?
from statsforecast.
`ValueError Traceback (most recent call last)
in <cell line: 14>()
12 )
13
---> 14 sf.fit(df)
15 sf.predict(h=12, level=[95])
4 frames
/usr/local/lib/python3.10/dist-packages/statsforecast/core.py in fit(self, df, sort_df, prediction_intervals)
878 self.prepare_fit(df, sort_df)
879 if self.n_jobs == 1:
--> 880 self.fitted = self.ga.fit(models=self.models)
881 else:
882 self.fitted_ = self._fit_parallel()
/usr/local/lib/python3.10/dist-packages/statsforecast/core.py in fit(self, models)
75 for i_model, model in enumerate(models):
76 new_model = model.new()
---> 77 fm[i, i_model] = new_model.fit(y=y, X=X)
78 return fm
79
/usr/local/lib/python3.10/dist-packages/statsforecast/models.py in fit(self, y, X)
362 )
363
--> 364 self._store_cs(y=y, X=X)
365 return self
366
/usr/local/lib/python3.10/dist-packages/statsforecast/models.py in _store_cs(self, y, X)
133 def _store_cs(self, y, X):
134 if self.prediction_intervals is not None:
--> 135 self._cs = self._conformity_scores(y, X)
136
137 def _add_conformal_intervals(self, fcst, y, X, level):
/usr/local/lib/python3.10/dist-packages/statsforecast/models.py in _conformity_scores(self, y, X)
124 )
125 fcst_window = self.forecast(h=h, y=y_train, X=X_train, X_future=X_future) # type: ignore[attr-defined]
--> 126 cs[i_window] = np.abs(fcst_window["mean"] - y_test)
127 return cs
128
ValueError: operands could not be broadcast together with shapes (7,) (2,)`
from statsforecast.
Ah, in this case your series are too short. You're asking for 3 windows of size 7, which requires at least 22 samples, but you probably have series with less points than that. You can either remove those series or adjust the intervals settings.
from statsforecast.
Related Issues (20)
- remove numba dependency HOT 2
- Adding support for NPTS and Seasonal NPTS HOT 3
- Adding bootstrapping functionnality from residuals of a model
- [Models] provide summary
- StatsForecast/AutoArima ZeroDivisionError HOT 2
- Prediction Interval Questions HOT 6
- Croston: Error fitting with 0.0 values HOT 1
- Make best fitted ARIMA an output of AutoARIMA HOT 2
- IMAPA Model not working in statsforecast=="1.7.2" HOT 1
- Allow external regressors TBATS HOT 2
- FutureWarning in AirPassengersDF
- can we reduce the prediction accuracy HOT 18
- [AutoETS] Access the model components (Error, Trend and Seasonality) HOT 1
- MSTL Plot HOT 2
- [AutoTBATS,TBATS] Usage example HOT 3
- AutoARIMA import error HOT 2
- Nixtla statsforecast/statsmodels failing to import polars HOT 3
- Independency of Time Series with Different Unique IDs HOT 2
- [Question] AutoARIMA.forward HOT 5
- Statsforecat.predict expects wrong dataframe shape on X_df HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsforecast.