I read this document: https://iamtrask.github.io/2015/11/15/anyone-can-code-lstm/ It was pretty simple, but I don't understand how to use it for predict the next sequence (for example) in trading systems.

In the above article it "loops" and returns each cycle a "bit", but if do I need only ONE output (like in trading systems)?

I suppose that I have to feed "outputs" also/only, is this right?

Thank you


1 Answer 1


Absolutely yes, Vanilla RNNs can be very good predictors for time series data. You can check this detailed official TensorFlow on time series forecasting, for example.

As they said in part 1:

the model will be given the last 20 recorded temperature observations, and needs to learn to predict the temperature at the next time step

This also gives you information about how to structure your data for training. Given an input sequence of given length, predict the next n steps of the series - where n can be 1 or more. The choice is very task-specific.

Assuming you are working with univariate time series (i.e. single series with no other variables) then you can shape your X_train as:

( number of observations , length of input series , 1 )

If you are working with multivariate datasets, then change 1 with your number of explanatory variables.

At each training iteration, the model will look at input data, and the actual outcome, and try to "learn" a mapping between x and y.

  • $\begingroup$ Thank you very much for your answer $\endgroup$ May 12, 2020 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.