Exponential Smoothing Model

88 views
Skip to first unread message

Jordan Howell

unread,
Sep 15, 2022, 9:16:50 AM9/15/22
to pystatsmodels
Hi.  

I'm trying to run a Holt Winters Exponential Smoothing model on different products.  Some of these run fine.  Others are starting to give the following error: 

'''
/opt/conda/lib/python3.7/site-packages/statsmodels/tsa/base/tsa_model.py:471: ValueWarning: An unsupported index was provided and will be ignored when e.g. forecasting. self._init_dates(dates, freq)
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) /tmp/ipykernel_16704/1147923803.py in <module> ----> 1 hw = ExponentialSmoothing(train['eaches'], initialization_method = 'legacy-heuristic', trend = 'add', seasonal = 'add', seasonal_periods=12) /opt/conda/lib/python3.7/site-packages/pandas/util/_decorators.py in wrapper(*args, **kwargs) 205 else: 206 kwargs[new_arg_name] = new_arg_value --> 207 return func(*args, **kwargs) 208 209 return cast(F, wrapper) /opt/conda/lib/python3.7/site-packages/statsmodels/tsa/holtwinters/model.py in __init__(self, endog, trend, damped_trend, seasonal, seasonal_periods, initialization_method, initial_level, initial_trend, initial_seasonal, use_boxcox, bounds, dates, freq, missing) 290 self._lambda = np.nan 291 self._y = self._boxcox() --> 292 self._initialize() 293 self._fixed_parameters = {} 294 /opt/conda/lib/python3.7/site-packages/statsmodels/tsa/holtwinters/model.py in _initialize(self) 423 raise ValueError(msg.format("seasonal")) 424 if self._initialization_method == "legacy-heuristic": --> 425 return self._initialize_legacy() 426 elif self._initialization_method == "heuristic": 427 return self._initialize_heuristic() /opt/conda/lib/python3.7/site-packages/statsmodels/tsa/holtwinters/model.py in _initialize_legacy(self) 453 454 def _initialize_legacy(self): --> 455 lvl, trend, seasonal = self.initial_values(force=True) 456 self._initial_level = lvl 457 self._initial_trend = trend /opt/conda/lib/python3.7/site-packages/statsmodels/tsa/holtwinters/model.py in initial_values(self, initial_level, initial_trend, force) 1235 b0 = np.exp((np.log(lead.mean()) - np.log(lag.mean())) / m) 1236 else: -> 1237 b0 = ((lead - lag) / m).mean() 1238 s0 = list(y[:m] / l0) if seasonal == "mul" else list(y[:m] - l0) 1239 elif has_trend: ValueError: operands could not be broadcast together with shapes (11,) (12,)
``` 

I'm not sure where the broadcast error is coming from because each of these models are the same test data shape of (12, 52) and train data shape of (23, 52).  Does anyone see what may be wrong with this? 
Reply all
Reply to author
Forward
0 new messages