You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like the right diagnostic. Every instance of hardcoded "root" in the functions.py file should be replaced via param. I'm backed up, you think you could give this a go? @aakashparsi
Describe the bug
When I'm using a custom root name rather than
total
, I've got KeyError:total
from theforecast_proportions
method.To Reproduce
Error Trace
KeyError Traceback (most recent call last)
in
----> 1 pred = htsfit.predict(steps_ahead = forecast_horizon)
~/.local/lib/python3.6/site-packages/hts/core/regressor.py in predict(self, exogenous_df, steps_ahead, distributor, disable_progressbar, show_warnings, **predict_kwargs)
350 self.hts_result.errors = (key, error)
351 self.hts_result.residuals = (key, residual)
--> 352 return self._revise(steps_ahead=steps_ahead)
353
354 def _revise(self, steps_ahead: int = 1) -> pandas.DataFrame:
~/.local/lib/python3.6/site-packages/hts/core/regressor.py in _revise(self, steps_ahead)
357 forecasts=self.hts_result.forecasts,
358 mse=self.hts_result.errors,
--> 359 nodes=self.nodes,
360 )
361
~/.local/lib/python3.6/site-packages/hts/revision.py in revise(self, forecasts, mse, nodes)
77
78 elif self.name == MethodT.FP.name:
---> 79 return forecast_proportions(forecasts, nodes)
80
81 else:
~/.local/lib/python3.6/site-packages/hts/functions.py in forecast_proportions(forecasts, nodes)
223 fore_sum = fore_sum[:, np.newaxis]
224 if column == 0:
--> 225 rev_top = np.array(forecasts["total"].yhat)
226 rev_top = rev_top[:, np.newaxis]
227 else:
KeyError: 'total'
Desktop (please complete the following information):
Additional context
Perhaps, the
total
in theforecast_proportions
method should be replaced with the root parameter passed in thefit
method.The text was updated successfully, but these errors were encountered: