sassoftware / python-dlpy

The SAS Deep Learning Python (DLPy) package provides the high-level Python APIs to deep learning methods in SAS Visual Data Mining and Machine Learning. It allows users to build deep learning models using friendly Keras-like APIs.
Apache License 2.0
224 stars 131 forks source link

Multistep Multivariate Time Series #246

Closed pynyah closed 4 years ago

pynyah commented 4 years ago

Hi,

I am building a forecast model by using LSTM through DLPY framework. My model is built, however, when it comes to extending the forecast beyond test data, it is throwing an error. I am using this statement "forecast_tbl = model1.forecast( horizon=400)" Does it mean that I need to always provide a dataset to get the extended forecast in case of multivariate situation? (I get an output if I provide a test dataset in model1.forecast, however, I am not able to extend the forecast beyond the index of test_data) Capture

sasxianhu commented 4 years ago

Can you share the notebook if possible? It should work with multivariate if you follow all the steps from https://github.com/sassoftware/python-dlpy/blob/master/examples/time_series_forecasting/Multisteps_vs_Onestep_ahead_Forecasting.ipynb to prepare the data and train the model.

pynyah commented 4 years ago

Can you share the notebook if possible? It should work with multivariate if you follow all the steps from https://github.com/sassoftware/python-dlpy/blob/master/examples/time_series_forecasting/Multisteps_vs_Onestep_ahead_Forecasting.ipynb to prepare the data and train the model.

Infact, I tried replicating the example shared in the link. However, if i try to have an extended forecast beyond the length of test data, it throws an error. (i.e. model.forecast(horizon=400) ) in case of multivariate forecasting. Please find the notebook Test.zip

sasxianhu commented 4 years ago

OK. I checked the source codes as well as the API doc: test_table : string or :class:CASTable, optional Specifies the test table. If test_table=None, the model cannot have additional static covariates or predictor timeseries, and can only be a autoregressive model. In this case, the forecast extends the timeseries from the last timestamp found in the training/validation set. If the model contains additional static covariates or predictor timeseries (that are available for predicting the target timeseries), the test table has to be provided, and the forecast starts from the first timestamp in the test data. If the model is autoregressive, and the test data columns do not include all the required preceeding time points of the target series (the lagged target variables), the forecast will be extended from the last time timestamp in training/validation set and only use the static covariates or predictor timeseries information from the test data if they are available for the corresponding time points. Default : None

Yes, you have to specify test_table and it can only predict when the table contains the input features for all your time steps.

pynyah commented 4 years ago

OK. I checked the source codes as well as the API doc: test_table : string or :class:CASTable, optional Specifies the test table. If test_table=None, the model cannot have additional static covariates or predictor timeseries, and can only be a autoregressive model. In this case, the forecast extends the timeseries from the last timestamp found in the training/validation set. If the model contains additional static covariates or predictor timeseries (that are available for predicting the target timeseries), the test table has to be provided, and the forecast starts from the first timestamp in the test data. If the model is autoregressive, and the test data columns do not include all the required preceeding time points of the target series (the lagged target variables), the forecast will be extended from the last time timestamp in training/validation set and only use the static covariates or predictor timeseries information from the test data if they are available for the corresponding time points. Default : None

Yes, you have to specify test_table and it can only predict when the table contains the input features for all your time steps. Thanks for the response. Does it mean that I can not extend the forecast horizon beyond the length of the test_table?

sasxianhu commented 4 years ago

No, you cannot extend the horizon beyond the length of your test_table. The input features have to be computed first and stored in the test_table.

ethem-kinginthenorth commented 4 years ago

I am closing this issue, @pynyah please ping us back if you have further questions. thanks