statsforecast
statsforecast copied to clipboard
[MSTL] error from supersmoother
What happened + What you expected to happen
season=1
<array_function internals>:200: RuntimeWarning: invalid value encountered in cast <array_function internals>:200: RuntimeWarning: invalid value encountered in cast <array_function internals>:200: RuntimeWarning: invalid value encountered in cast
RemoteTraceback Traceback (most recent call last) RemoteTraceback: """ Traceback (most recent call last): File "/Users/shnguo/miniconda3/envs/statsforecast_test/lib/python3.10/multiprocessing/pool.py", line 125, in worker result = (True, func(*args, **kwds)) File "/Users/shnguo/Dinglan/fastapi_server/statsforecast/statsforecast/core.py", line 204, in forecast raise error File "/Users/shnguo/Dinglan/fastapi_server/statsforecast/statsforecast/core.py", line 190, in forecast res_i = model.forecast( File "/Users/shnguo/Dinglan/fastapi_server/statsforecast/statsforecast/models.py", line 4406, in forecast model_ = mstl( File "/Users/shnguo/Dinglan/fastapi_server/statsforecast/statsforecast/mstl.py", line 62, in mstl trend = SuperSmoother().fit(t, x).predict(t) File "/Users/shnguo/miniconda3/envs/statsforecast_test/lib/python3.10/site-packages/supersmoother/smoother.py", line 32, in fit self._fit(self.t, self.y, self.dy) File "/Users/shnguo/miniconda3/envs/statsforecast_test/lib/python3.10/site-packages/supersmoother/supersmoother.py", line 60, in _fit ysmooth_primary = np.array([smoother.fit(t, y, dy, presorted=True) File "/Users/shnguo/miniconda3/envs/statsforecast_test/lib/python3.10/site-packages/supersmoother/supersmoother.py", line 61, in .cv_values() File "/Users/shnguo/miniconda3/envs/statsforecast_test/lib/python3.10/site-packages/supersmoother/smoother.py", line 53, in cv_values return self._cv_values(cv) File "/Users/shnguo/miniconda3/envs/statsforecast_test/lib/python3.10/site-packages/supersmoother/smoother.py", line 123, in _cv_values return self._smoothfunc(self.t, self.y, self.dy, cv=cv, ... 772 return self._value 773 else: --> 774 raise self._value
ValueError: Zero denominator in linear smooth. This usually indicates that the input contains duplicate points.
Versions / Dependencies
newest
Reproduction script
season_length=1 models = [ MSTL( season_length=[season_length, season_length * 7], # seasonalities of the time series trend_forecaster=AutoARIMA() # model used to forecast trend ), # AutoARIMA(season_length=season_length), # ETS(season_length=season_length), # Naive() ] sf = StatsForecast( df=df2, models=models, freq='D', n_jobs=-1 ) Y_hat_df = sf.forecast(horizon)
Issue Severity
High: It blocks me from completing my task.
Receiving the same error using MSTL
. @shnguo were you able to resolve it?