I'm working on a multivariate (100+ variables) multi-step (t1 to t30) forecasting problem where the time series frequency is every 1 minute. The problem requires to forecast one of the 100+ variables as target. I'm interested to know if it's possible to do it using FB Prophet's Python API. I was able to do it in a univariate fashion using only the target variable and the datetime variable. Any help and direction is appreciated. Please let me know if any further input or clarity is needed on the question.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
To do forecasting for more than one dependent variable you need to implement that time series using Vector Auto Regression.
In VAR model, each variable is a linear function of the past values of itself and the past values of all the other variables.
for more information on VAR go to https://www.analyticsvidhya.com/blog/2018/09/multivariate-time-series-guide-forecasting-modeling-python-codes/
You can add additional variables in Prophet using the add_regressor method.
For example if we want to predict variable
y
using also the values of the additional variablesadd1
andadd2
.Let's first create a sample df:
and split train and test:
Before training the forecaster, we can add regressors that use the additional variables. Here the argument of
add_regressor
is the column name of the additional variable in the training df.The predict method will then use the additional variables to forecast:
Note that the additional variables should have values for your future (test) data. If you don't have them, you could start by predicting
add1
andadd2
with univariate timeseries, and then predicty
withadd_regressor
and the predictedadd1
andadd2
as future values of the additional variables.From the documentation I understand that the forecast of
y
for t+1 will only use the values ofadd1
andadd2
at t+1, and not their values at t, t-1, ..., t-n as it does withy
. If that is important for you, you could create new additional variables with the lags.See also this notebook, with an example of using weather factors as extra regressors in a forecast of bicycle usage.
This might be late, however if you are reading this in 2019, you can implement multivariate time series using LSTM, Keras.