【发布时间】:2018-11-29 01:31:18
【问题描述】:
我已经建立了一个可以预测未来价格的 LSTM 模型。我已经用已经存在的地面真值进行了测试,以了解模型的准确性。现在我想使用相同的模型来预测我们不知道基本事实的值。我执行以下代码来对 449 条新记录进行预测。
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))
你能告诉我哪里出错了吗?如果您需要更多详细信息,请告诉我
【问题讨论】:
-
我想我想通了。实际的图表(图 1)实际上使用了正确的基本事实,这使得预测更加准确。而我的结果实际上在其时间步中使用了预测值。我认为我的理解是正确的。但也请告诉我您的意见