You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-9Lines changed: 15 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -435,20 +435,26 @@ In order to normalise the data, we need to scale it between 0 and 1 so we talk o
435
435
436
436
### 3.3) Adding Timesteps
437
437
438
-
LSTM network needs the data imported as a 3D array. To translate this 2D array into a 3D one, we use a short [timestep](http://colah.github.io/posts/2015-08-Understanding-LSTMs/)to loop through the data and create smaller partitions and feed them into the model. The final array is then reshaped into training samples, x number of timesteps, and 1 feature per step. The code below represents this concept:
438
+
To implement the LSTM network for time series forecasting, we have used a [time step](http://colah.github.io/posts/2015-08-Understanding-LSTMs/)of 3 days. This technique allows the network to look back at the previous 3 days of data to predict the subsequent day. The figure below illustrates how this concept is used in our implementation, where the first 3 samples for Close price generate the 4th sample and so on. This generates a matrix of shape (3,1), with 3 representing the time steps and 1 representing the number of features (Close price).
We have implemented a time step of 3 days. Using this technique, we allow our network to look back 3 days on our data to predict the subsequent day). The figure below represents how our implementation uses this concept and how the first 3 samples for Close price would generate the 4th sample and so on.This will generate a matrix of shape (3,1), 3 being the time steps and 1 the number of features (Close price).
# Append the next day's Close price to the label array
454
+
y_train.append(train_scaled[i, 0])
455
+
```
456
+
457
+
Using a time step of 3 days allows the LSTM network to identify patterns in the data and make predictions based on those patterns. By using a sliding window approach, we can train the network to predict future stock prices based on historical data.
0 commit comments