yacoubb / stock-trading-ml

A stock trading bot that uses machine learning to make price predictions.
GNU General Public License v3.0
612 stars 254 forks source link

Exposing future prices in training #21

Open krajit opened 4 years ago

krajit commented 4 years ago

Dear Yacoubb,

Your predictions seem too good to be true. I believe you are exposing future prices in training. When you turn on the shuffle option in the fit, it seems it first shuffles and then splits.

model.fit(x=ohlcv_train, y=y_train, batch_size=32, epochs=50, shuffle=True, validation_split=0.1) So, the 10 % split is not necessarily the last 10 %, but some middle value.

huw-rhys-jones commented 3 years ago

That's the validation set, not the testing set. The validation set are randomly selected points throughout the data-set, yes, but there's also the testing set, which really is at the chronological end of the whole data-set.