I have built an LSTM model that can forecast the future prices. I have tested the same with ground truth value that exists already to know the accuracy of the model. Now I wanted to use the same model to predict the value for which we dont know the ground truth.I did the below code to perform forecasting for 449 new records.
Test = Stock_AREIT[len(Stock_AREIT)-60:]
Test=Test['1. open']
inputs=Test.values
inputs = inputs.reshape(-1,1)
# Scale inputs but not actual test values
inputs = sc.transform(inputs)
for test in range(0,449):
inputs=np.append(inputs,predicted_stock_price)
inputs=inputs.reshape(-1,1)
print(inputs.shape)
X_test=[]
for i in range(60, 61):
X_test.append(inputs[test:i+test,0])
# make list to array
X_test = np.array(X_test)
X_test = np.reshape(X_test,(X_test.shape[0], X_test.shape[1],1))
predicted_stock_price = regressor.predict(X_test)
inputs=np.delete(inputs,len(inputs)-1,axis=0)
inputs=np.append(inputs,predicted_stock_price)
inputs=inputs.reshape(-1,1)
print("currently running {}".format(test))
The actual forecast of the model should be like the below figure
But for the code above, I am getting the below graph
Can you please let me know where I am going wrong ? Please let me know if you need further details