Last Updated on August 5, 2019
Long Short-Term Memory (LSTM) is a type of recurrent neural network that can learn the order dependence between items in a sequence.
LSTMs have the promise of being able to learn the context required to make predictions in time series forecasting problems, rather than having this context pre-specified and fixed.
Given the promise, there is some doubt as to whether LSTMs are appropriate for time series forecasting.
In this post, we will look at the application of LSTMs to time series forecasting by some of the leading developers of the technique.
Discover how to build models for multivariate and multi-step time series forecasting with LSTMs and more in my new book, with 25 step-by-step tutorials and full source code.
Let’s get started.
What You Will Learn
- 1 LSTM for Time Series Forecasting
- 2 Autoregression
- 3 Analysis of Results
- 4 Final Word
- 5 Develop Deep Learning models for Time Series Today!
LSTM for Time Series Forecasting
We will take a closer look at a paper that seeks to explore the suitability of LSTMs for time series forecasting.
The paper is titled “Applying LSTM to Time Series Predictable through Time-Window Approaches” (get the PDF, Gers, Eck and Schmidhuber, published in 2001.
They start off by commenting that univariate time series forecasting problems are actually simpler than the types of problems traditionally used to demonstrate the capabilities of LSTMs.
Time series benchmark problems found in the literature … are often conceptually simpler than many tasks already solved by LSTM. They often do not require RNNs at all, because all relevant information about the next event is conveyed by a few recent events contained within a small time window.
The paper focuses on the application of LSTMs to two complex time series forecasting problems and contrasting the results of LSTMs to other types of neural networks.
The focus of the study are two classical time series problems:
This is a contrived time series calculated from a differential equation.
For more information, see:
Chaotic Laser Data (Set A)
This is a series taken from a from a contest at the Santa Fe Institute.
Set A is defined as:
A clean physics laboratory experiment. 1,000 points of the fluctuations in a far-infrared laser, approximately described by three coupled nonlinear ordinary differential equations.
For more information, see:
Need help with Deep Learning for Time Series?
Take my free 7-day email crash course now (with sample code).
Click to sign-up and also get a free PDF Ebook version of the course.
An autoregression (AR) approach was used to model these problems.
This means that the next time step was taken as a function of some number of past (or lag) observations.
This is a common approach for classical statistical time series forecasting.
The LSTM is exposed to one input at a time with no fixed set of lag variables, as the windowed-multilayer Perceptron (MLP).
For more information on AR for time series, see the post:
Analysis of Results
Some of the more salient comments were in response to the poor results of the LSTMs on the Mackey-Glass Series problem.
First, they comment that increasing the learning capacity of the network did not help:
Increasing the number of memory blocks did not significantly improve the results.
This may have required a further increase in the number of training epochs. It is also possible that a stack of LSTMs may have improved results.
They comment that in order to do well on the Mackey-Glass Series, the LSTM is required to remember recent past observations, whereas the MLP is given this data explicitly.
The results for the AR-LSTM approach are clearly worse than the results for the time window approaches, for example with MLPs. The AR-LSTM network does not have access to the past as part of its input … [for the LSTM to do well] required remembering one or two events from the past, then using this information before over-writing the same memory cells.
They comment that in general, this poses more of a challenge for LSTMs and RNNs than it does for MLPs.
Assuming that any dynamic model needs all inputs from t-tau …, we note that the AR-RNN has to store all inputs from t-tau to t and overwrite them at the adequate time. This requires the implementation of a circular buffer, a structure quite difficult for an RNN to simulate.
Again, I can’t help but think that a much larger hidden layer (more memory units) and a much deeper network (stacked LSTMs) would be better suited to learn multiple past observations.
They later conclude the paper and discuss that based on the results, LSTMs may not be suited to AR type formulations of time series forecasting, at least when the lagged observations are close to the time being forecasted.
This is a fair conclusion given the LSTMs performance compared to MLPs on the tested univariate problems.
A time window based MLP outperformed the LSTM pure-AR approach on certain time series prediction benchmarks solvable by looking at a few recent inputs only. Thus LSTM’s special strength, namely, to learn to remember single events for very long, unknown time periods, was not necessary here.
LSTM learned to tune into the fundamental oscillation of each series but was unable to accurately follow the signal.
They do highlight the LSTMs ability to learn oscillation behavior (e.g. cycles or seasonality).
Our results suggest to use LSTM only on tasks where traditional time window-based approaches must fail.
LSTM’s ability to track slow oscillations in the chaotic signal may be applicable to cognitive domains such as rhythm detection in speech and music.
This is interesting, but perhaps not as useful, as such patterns are often explicitly removed wherever possible prior to forecasting. Nevertheless, it may highlight the possibility of LSTMs learning to forecast in the context of a non-stationary series.
So, what does all of this mean?
Taken at face value, we may conclude that LSTMs are unsuitable for AR-based univariate time series forecasting. That we should turn first to MLPs with a fixed window and only to LSTMs if MLPs cannot achieve a good result.
This sounds fair.
I would argue a few points that should be considered before we write-off LSTMs for time series forecasting:
- Consider more sophisticated data preparation, such as at least scaling and stationarity. If a cycle or trend is obvious, then it should be removed so that the model can focus on the underlying signal. That being said, the capability of LSTMs to perform well on non-stationary data as well or better than other methods is intriguing, but I would expect would be commensurate with an increase in required network capacity and training.
- Consider the use of both larger models and hierarchical models (stacked LSTMs) to automatically learn (or “remember”) a larger temporal dependence. Larger models can learn more.
- Consider fitting the model for much longer, e.g. thousands or hundreds of thousands of epochs, whilst making use of regularization techniques. LSTMs take a long time to learn complex dependencies.
I won’t point out that we can move beyond AR based models; it’s obvious, and AR models are a nice clean proving ground for LSTMs to consider and take on classical statistical methods like ARIMA and well performing neural nets like window MLPs.
I believe there’s great promise and opportunity for LSTMs applied to the problem of time series forecasting.
Do you agree?
Let me know in the comments below.
Develop Deep Learning models for Time Series Today!
Develop Your Own Forecasting models in Minutes
…with just a few lines of python code
Discover how in my new Ebook:
Deep Learning for Time Series Forecasting
It provides self-study tutorials on topics like:
Multivariate Forecasting, Multi-Step Forecasting and much more…
Finally Bring Deep Learning to your Time Series Forecasting Projects
Skip the Academics. Just Results.
See What’s Inside