Closed PeggyFan closed 3 years ago
I am so excited to have found this package, but I've run into a wall.
I was able to fit the model without an issue. But I cannot figure out why when I tried preds = model.predict(steps_ahead=7), this error occurs:
preds = model.predict(steps_ahead=7)
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-78-45543541ce5b> in <module> ----> 1 preds = model.predict(steps_ahead=7) ~/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/core/regressor.py in predict(self, exogenous_df, steps_ahead, distributor, disable_progressbar, show_warnings, **predict_kwargs) 292 self.hts_result.errors = (key, error) 293 self.hts_result.residuals = (key, residual) --> 294 return self._revise(steps_ahead=steps_ahead) 295 296 def _revise(self, steps_ahead=1): ~/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/core/regressor.py in _revise(self, steps_ahead) 303 304 revised_columns = list(make_iterable(self.nodes)) --> 305 revised_index = self._get_predict_index(steps_ahead=steps_ahead) 306 return pandas.DataFrame(revised, 307 index=revised_index, ~/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/core/regressor.py in _get_predict_index(self, steps_ahead) 311 312 freq = getattr(self.nodes.item.index, 'freq', 1) --> 313 print(freq) 314 start = self.nodes.item.index[-1] + freq 315 end = self.nodes.item.index[-1] + (steps_ahead * freq) TypeError: unsupported operand type(s) for +: 'Timestamp' and 'NoneType'
My input data frame df is
df
Data columns (total 4 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 leveA_92_levelB_349 736 non-null int64 1 levelA_92_levelB_508 736 non-null int64 2 levelA_92 736 non-null int64 3 total 736 non-null int64
and date is the set as the index of df and there is no missing values in the date index.
date
How can I start debugging this? So bummed that I can't proceed.
Found the solution in the old PR #30 https://github.com/carlomazzaferro/scikit-hts/issues/30
I am so excited to have found this package, but I've run into a wall.
I was able to fit the model without an issue. But I cannot figure out why when I tried
preds = model.predict(steps_ahead=7)
, this error occurs:My input data frame
df
isand
date
is the set as the index ofdf
and there is no missing values in thedate
index.How can I start debugging this? So bummed that I can't proceed.