简体   繁体   中英

Getting error (numpy.ndarray' object is not callable) while running following code in Jupyter

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)))

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM