LSTM for time series forecasting
37 views (last 30 days)
Show older comments
Nestoras Papadopoulos
on 30 Nov 2023
Commented: Nestoras Papadopoulos
on 5 Jan 2024
Hello,
I am trying to solve a time series forecasting problem and as I am new to deep learning I followed the chickepox example which works well.
For better prediction I want to use 3 more parallel time series data which affect my other time series for prediction. I tried to follow the "time series forecasting using deep learning" example but the training data there, are a part of the time series number. What's the best strategy for handling the above data? Is there an example like mine?
2 Comments
Accepted Answer
Shubham
on 28 Dec 2023
Hi Nestoras,
When you're dealing with multiple parallel time series that affect each other, you're looking at a multivariate time series forecasting problem. Deep learning models, particularly Recurrent Neural Networks (RNNs) like Long Short-Term Memory (LSTM) networks, are well-suited for this kind of task.
The general strategy for handling multivariate time series data is to format your data such that each time step includes feature vectors that incorporate all the relevant variables. For example, if you have four parallel time series (including the original one you're trying to predict), each time step in your input data will include a vector with four elements.
Here are some steps to help you adapt the chickenpox example to your multivariate scenario:
- Format your data: As shown in the code snippet above, combine your time series into a single dataset where each time step includes all relevant variables.
- Define the architecture of your LSTM network: Depending on the complexity of your problem, you might need to adjust the number of LSTM layers and the number of units in each layer.
- Train the LSTM network: Use the formatted data to train the network. Make sure to split your data into training and validation sets to monitor for overfitting.
- Evaluate the model: After training, evaluate your model on a test set to see how well it generalizes to unseen data.
- Forecast future values: Use the trained model to forecast future time steps. For multivariate forecasting, you will need to provide values for all input variables, not just the historical values of the series you're trying to predict.
Remember to normalize your data if necessary, as LSTM networks are sensitive to the scale of the input data. Also, consider experimenting with different architectures, hyperparameters, and data preprocessing techniques to improve performance.
2 Comments
More Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!