检查模型的稳健性 在本节中,我们将检查LSTM模型的健壮性。从2017年7月1日到2017年7月20日,我使用了新的看不见的数据集。我从谷歌金融网站下载了数据集,以检查模型的稳健性
import preprocess_data as ppd
data = pd.read_csv('E:/DBSOM DATA\FOM_Sem 2/Analyses of S&U Data/Project work/Stock-Price-Prediction-
master/googl.csv')
stocks = ppd.remove_data(data)
stocks = ppd.get_normalised_data(stocks)
stocks = stocks.drop(['Item'], axis = 1)
#Print the dataframe head and tail
print(stocks.head())
#X = stocks[:].as_matrix()
#Y = stocks[:]['Close'].as_matrix()
X = stocks[:].values()
Y = stocks[:]['Close'].values()
X = sd.unroll(X,1)
Y = Y[-X.shape[0]:]
print(X.shape)
print(Y.shape)
# Generate predictions
predictions = model.predict(X)
#get the test score
testScore = model.evaluate(X, Y, verbose=0)
print('Test Score: %.4f MSE (%.4f RMSE)' % (testScore, math.sqrt(testScore)))
.values
属性不应具有()
:注意:documentation for ^{} 表示不再建议使用}
.values
,建议改用^{相关问题 更多 >
编程相关推荐