# Using predicted values to predict next step X_pred = Xtest.copy() for i in range(window,len(X_pred)): xin = X_pred[i-window:i].reshape((1, window, 1)) X_pred[i] = m.predict(xin) # Plot prediction vs actual for test data plt.figure() plt.plot(X_pred[window:],':',label='LSTM') plt.plot(next_X1,'--',label='Actual') plt.legend()