Answers.Body: <p>I can't say for all cases, but I can certainly give you an example of how an LSTM <em>could</em> be used to predict stock prices.</p>
  
  <p>An LSTM is temporal, meaning you can feed in one input, get an output and the network will remember this interaction (if it's important), which will effect the outcome of future predictions. As such, it is reasonable to feed in all the data for the day (Open, Close etc), obtain an output for the predicted stock price of the following day (or a prediction for all the inputs you feed in, the output can be as large or small as you want), then repeat for as long as you want, each time only feeding in the data for that particular day as the network will remember previous days.</p>
  
  <p>In your example, 60 timesteps would mean doing a forward pass of the LSTM 60 times, for 60 days. Each of these forward passes will produce an output, which you can compare to the next actual stock price for verification, until you reach the current day, where the prediction is for the future.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-30T04:38:04.413Z
Answers.Text: @Reccessice I was thinking feed in 0-59 days first, get an output for day 60, then feed in days 1-60 get output day 61 and hope it remembers certain patterns. This is for training the model. So the result of day 0-59 input will be passed onto the next loop of day 1-60. Would this be correct?
Answers.UserDisplayName: user33121
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-30T04:54:24.840Z
Answers.Text: @user33121 If you trained your data on time periods of 60 days, then yes this is definitely the way to go. Just as a warning, don't extend the LSTM past the maximum temporal depth of training and expect coherent results
Answers.UserDisplayName: Recessive
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-30T05:17:55.240Z
Answers.Text: What is the depth? Do you mean as in over-training the data?
Answers.UserDisplayName: user33121
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-30T05:30:42.650Z
Answers.Text: @user33121 No by temporal depth I mean the number of times you feed input into the LSTM. So if you feed in 60 days in training, then do weight updates and repeat, don't then feed in 80 days in testing and expect reasonable outputs past day 60 as the LSTM was never trained to go that far
Answers.UserDisplayName: Recessive
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-30T02:09:52.613Z
Answers.LastActivityDate: 2020-01-30T02:09:52.613Z
Answers.UserDisplayName: Recessive
Body: <p>I'm trying to develop a stock predictor. </p>
  
  <p>I'm using LSTM but I am unsure about the structure of the Neural Network. For example, I'm assuming that the Neural Network is a many-to-one since we have many inputs (i.e Open, Close etc) and one output (stock price).</p>
  
  <p>By misunderstanding is coming with how to construct the nodes. For example, what input goes into the "Cell" (or node)? I.e does say 60 timestep mean 60 days of 'Open Price' are fed into the Neural Network at t and then 60 days of 'Close' into t + 1 until we use all input to produce an output?</p>
  
  <p>If someone could explain the process of how LSTM are used with stock predictions that would be appreciated. </p>
  
Tags: <neural-networks><deep-learning><ai-design><long-short-term-memory>
Title: How should I design this LSTM network to perform stock prediction?
UserDisplayName: user33121
ThreadText: # How should I design this LSTM network to perform stock prediction?
  
  (Asked by: username_0 on 2020-01-29)
  
  I'm trying to develop a stock predictor.
  
  I'm using LSTM but I am unsure about the structure of the Neural Network. For example, I'm assuming that the Neural Network is a many-to-one since we have many inputs (i.e Open, Close etc) and one output (stock price).
  
  By misunderstanding is coming with how to construct the nodes. For example, what input goes into the "Cell" (or node)? I.e does say 60 timestep mean 60 days of 'Open Price' are fed into the Neural Network at t and then 60 days of 'Close' into t + 1 until we use all input to produce an output?
  
  If someone could explain the process of how LSTM are used with stock predictions that would be appreciated.
  
  **Tags:** neural-networks, deep-learning, ai-design, long-short-term-memory
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-01-30. Score: 1
  
  I can't say for all cases, but I can certainly give you an example of how an LSTM *could* be used to predict stock prices.
  
  An LSTM is temporal, meaning you can feed in one input, get an output and the network will remember this interaction (if it's important), which will effect the outcome of future predictions. As such, it is reasonable to feed in all the data for the day (Open, Close etc), obtain an output for the predicted stock price of the following day (or a prediction for all the inputs you feed in, the output can be as large or small as you want), then repeat for as long as you want, each time only feeding in the data for that particular day as the network will remember previous days.
  
  In your example, 60 timesteps would mean doing a forward pass of the LSTM 60 times, for 60 days. Each of these forward passes will produce an output, which you can compare to the next actual stock price for verification, until you reach the current day, where the prediction is for the future.
  
  > **Comments:**
  > **username_0**: @Reccessice I was thinking feed in 0-59 days first, get an output for day 60, then feed in days 1-60 get output day 61 and hope it remembers certain patterns. This is for training the model. So the result of day 0-59 input will be passed onto the next loop of day 1-60. Would this be correct?  
  > **username_1**: @username_0 If you trained your data on time periods of 60 days, then yes this is definitely the way to go. Just as a warning, don't extend the LSTM past the maximum temporal depth of training and expect coherent results  
  > **username_0**: What is the depth? Do you mean as in over-training the data?  
  > **username_1**: @username_0 No by temporal depth I mean the number of times you feed input into the LSTM. So if you feed in 60 days in training, then do weight updates and repeat, don't then feed in 80 days in testing and expect reasonable outputs past day 60 as the LSTM was never trained to go that far  
  
  ---
  
  