Thanks for catching the issue.

I have modified the code.

  • Updated the logic to create the time series dataset
  • Updated the test data
  • Increased epochs from 100 to 200
  • Updated the dataset to plot the actual values

If I use the updated logic to create the time series before scaling the values and where lookback is just 1 step

First looking at the raw data


Then applying the updated logic

# time series with two inputs
lookback= 1
test_size=int(.3 * len(stock_data))
for i in range(len(stock_data)-lookback-1):
for j in range(0,lookback):

t.append(input_data[[(i+j)], :])
y.append(input_data[i+ lookback,1])

and then just printing first 5 values

for i in range(5):

print(str(X[i]) + " " + str(y[i]))

the output is

Please let me know if that fixes the problem


Loves learning, sharing, and discovering myself. Passionate about Machine Learning and Deep Learning

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store