Closed PeggyFan closed 3 years ago
Made some progress:
I replaced any if-statement that checks if exogenous_df
exists in hts/core/regressor.py
with exogenous_df is (not) None
and solved the above error message.
Then I encountered:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.8/3.8.6/Frameworks/Python.framework/Versions/3.8/lib/python3.8/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/pfan/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/utilities/distribution.py", line 40, in _function_with_partly_reduce
return list(results)
File "/Users/pfan/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/utilities/distribution.py", line 39, in <genexpr>
results = (map_function(chunk, kwargs) for chunk in chunk_list)
File "/Users/pfan/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/core/utils.py", line 97, in _do_actual_predict
model_instance = model_instance.predict(node=node,
File "/Users/pfan/analytics-etl/virtualenv/lib/python3.8/site-packages/hts/model/p.py", line 105, in predict
self.forecast = self.model.predict(future)
File "/Users/pfan/analytics-etl/virtualenv/lib/python3.8/site-packages/fbprophet/forecaster.py", line 1174, in predict
df = self.setup_dataframe(df.copy())
File "/Users/pfan/analytics-etl/virtualenv/lib/python3.8/site-packages/fbprophet/forecaster.py", line 272, in setup_dataframe
raise ValueError(
ValueError: Regressor 'precipitation' missing from dataframe
As shown in previous message, precipitation
does exist in exogenous_df
.
So I got stuck here again.
Do I need to pass more argument in the predict()
function?
Hi, I am having the same issue when trying to use exogenous variables in the predict function. Were you able to resolve the issue? Thank you!
I'm tracking this here: https://github.com/carlomazzaferro/scikit-hts/issues/55#issuecomment-834193602
Will update once progress is made. Currently tackling other issues, this one is next.
https://github.com/carlomazzaferro/scikit-hts/pull/73 closing here, let's keep track there
Hi, I am following the hts documentation to add exogenous variables to a model.
So far I succeeded in using the hmv
load_mobility_data()
, creating exogenous features for each node:exogenous = {k: ['precipitation', 'temp'] for k in hmv.columns if k not →in ['precipitation', 'temp']}
and pass it inThe model ran fine, but I can't figure out how to pass in the
exogenous_df
in thepredict()
function. The documentation says:For the hmv data, the exogenous features were
["temperature", "precipitation"]
so I passed in the data frame of 7 rows:and ran
preds = model.predict(steps_ahead=7, exogenous_df=exogenous_df)
But I'm not sure how to pass in the node information in the data frame. The hierarchy of the hmv data is:
The error I got (which is probably related to the missing node info in the above
exogenous_df
) is:Can someone provide an example of
exogenous_df
for thepredict()
function?Thank you!