alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

Trying to copy a LSTM model - it's not working in python ?

Trying to copy a LSTM model - it's not working in python ?

To add to the other answer, the train and test sets are built here:

 num = int(data_reframed.shape[0]*0.8)
value = data_reframed.values
train = value[:num, :]
test = value[num:, :]

train_x, train_y = train[:, :-1], train[:, -1]
test_x, test_y = test[:, :-1], test[:, -1] 

While yPredict is calculated here:

 yPredict = Model.predict(test_x) 

Hence, the shape of yPredict and test_y has to be the same, and that has to be (data_reframed.shape[0] - num,), since num is the size of the training set. So, you can write:

 plt.plot(data.index[num:], test_y, color='blue',label='Actual')
plt.plot(data.index[num:], yPredict, alpha=0.7, color='red',label='Predict')

25 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online