**A Long short-term memory** (**LSTM**) network is a special type of a recurrent neural network (RNN). It remembers values over arbitrary time intervals which makes it suited to be used for forecasting of time series.

I was struggling with the DL4J implementation of the LSTM to be used to forecast stock data and I was not sure where the issue was:

- was the data not suited for forecasting ?.
- did I have a bug in my Iterator which was generating the 3d arrays ?
- did i have an issue with the scaling of the data ?
- was the network setup not correct ?

So I decided to simplify the problem by using generated sinusoid data instead of real stock values in order to proof that the LSTM model is working as expected. Fortunately we can use the HarmonicStockOscillator class to generate the test data.

Here is my Gist.

## 0 Comments