awslabs / gluonts

Probabilistic time series modeling in Python
https://ts.gluon.ai
Apache License 2.0
4.46k stars 742 forks source link

DeepAR dynamic features = Covariates ? #458

Closed Math9999 closed 4 years ago

Math9999 commented 4 years ago

(Please state your question in the title, and add here any relevant details, like a description of the problem, code snippets, examples, and so on.)

Dataset: SML2010: consists of weather related parameters (13 series) such as temperature, relative humidity, sunlight intensity collected from a monitor system mounted in a house. (https://archive.ics.uci.edu/ml/datasets/SML2010)

Prediction: I would like to predict the temperature. Therefore I use temperature as the target time series and all other 12 series as covariates.

Question A: Can I set the covariates as dynamic features in DeepAR ? Does that make sense?

Question B: The time series are in a pandas dataframe. (https://github.com/awslabs/gluon-ts)

But how do I add one and in another example multiple dynamic features to one target series? The following example for just one dynamic feature does not work.
image

It would be great if you could help out.

All the best

gjmulder commented 4 years ago

Static features, by definition remain the same in the future, so can be reused for predicting.

Future values of dynamic features need to be provided as input to the prediction. Unless you can independently obtain (or forecast) your additional covariates then I think your approach won't work. Even if you did forecast them, you have trained on the actual values of your covariates and not the forecasted values, which will likely cause problems with your model accuracy. GIGO...

From memory you need to provide a 2D numpy array for feat_dynamic_real. Try using df.values

Math9999 commented 4 years ago

Thank you very much. Your explanation has clarified the situation.

timoschowski commented 4 years ago

A couple of more thoughts here: