philipxjm / Deep-Convolution-Stock-Technical-Analysis

Uses Deep Convolutional Neural Networks (CNNs) to model the stock market using technical analysis. Predicts the future trend of stock selections.
Apache License 2.0
597 stars 174 forks source link

There are logic error in codes. #4

Open amirkhango opened 6 years ago

amirkhango commented 6 years ago

I am very glad to find somebody focusing on Stock Market with DL technique. Before finding this github, I also pay some time on this and beat with some problems, this code gives me a good reference. Unfortunately, I find a fatal bug that indicates this github's CNN codes cannot run in reality. That is

# shuffling the data
perm = np.arange(labels_set.shape[0])
np.random.shuffle(perm)
stocks_set = stocks_set[perm]
labels_set = labels_set[perm]

The reason for that, in reality, stock stream comes with time order, this shuffle operation will break this rule. If you do not believe, you can comment these codes and run it, you would find your test accuracy dramatically decrease from 70% down to 50%. That means it can only behave well on train set but always sucks on test set.

TL;DR, stock price/index prediction by CNN is nearly a hard (even impossible) task, because it is essentially event-driven not data-driven (price-driven). The codes here belongs to data-driven (price-driven) methods. By the way, some researchers now pay much more attention on event-driven method, i.e., they grabbed event data of daily news and then use Deep Learning model to analysis it. But this method is relatively complicated.

MarStarck commented 6 years ago

ha, that's a permanent dispute between fundamental analysts and technical analysts.