Git Product home page Git Product logo

Comments (6)

baniasbaabe avatar baniasbaabe commented on June 1, 2024 1

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.

jmoralez avatar jmoralez commented on June 1, 2024

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.

baniasbaabe avatar baniasbaabe commented on June 1, 2024

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.

jmoralez avatar jmoralez commented on June 1, 2024

Can you include the full stacktrace?

from statsforecast.

baniasbaabe avatar baniasbaabe commented on June 1, 2024

`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.

jmoralez avatar jmoralez commented on June 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.