Issue
Checking Robustness of the model In this section we will check robustness of our LSTM model. I have used new unseen datasets for this from July 1, 2017 to July 20,2017. I have downloaded the data sets from google finance website to check for robustness of the model.
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)))
Solution
The .values
property shouldn't have ()
:
X = stocks[:].values
Y = stocks[:]['Close'].values
Note: the documentation for .values
says that .values
is no longer recommended, and recommends using .to_numpy()
instead.
Answered By - Jiří Baum
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.