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')
* Be the first to Make Comment