NGYB / Stocks

Programs for stock prediction and evaluation
Apache License 2.0
346 stars 209 forks source link

RuntimeWarning in the "Final Model" section #2

Closed Gineus closed 4 years ago

Gineus commented 5 years ago

When running

est_list = get_preds_mov_avg(df, 'adj_close', N_opt, 0, num_train+num_cv)
test['est' + '_N' + str(N_opt)] = est_list
print("RMSE = %0.3f" % math.sqrt(mean_squared_error(est_list, test['adj_close'])))
print("MAPE = %0.3f%%" % get_mape(test['adj_close'], est_list))
test.head()

The following warnings occur:

ipykernel_launcher.py:21: RuntimeWarning: invalid value encountered in less
ipykernel_launcher.py:2: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy
NGYB commented 4 years ago

Thanks. The RuntimeWarning is due to a NaN value in pred_list which is expected. I have also fixed the SettingWithCopyWarning issue in the latest commit here. Note these warnings do not impact the results.