Quantitatively Intuitive Views on Markets

Deep Learning for the Walk-Forward Loop

2017-01-28

In the previous posts in these series (here, here and here) I used conventional machine learning to forecast the trading opportunities. Lately however I have been trying to move more and more towards deep learning. My first attempt was to extend the walk-forward loop to support neural networks, the building blocks of deep learning.

To experiment with a neural network, I could have simply used the Multi-Layer Perceptron from the scikit-learn python package. That would have sufficed to experiment with neural networks for this specific purpose. While this would have been sufficient to get started, my feeling is that in the long run I would prefer to use deep learning more, thus, I decided to go a bit more advanced right off the bat.

There are quite a few deep learning network frameworks out there, but for a new comer Google’s Tensorflow seemed to make most sense. Since I work at Microsoft (hence a disclaimer: my opinions about Microsoft’s products may be biased), the only other framework I considered was Microsoft’s Cognitive Toolkit (also known as CNTK). I decided to go with the latter, but I will cover both in what follows.

Without going into too much details, my classifier first builds the computational graph (that’s why it’s deep learning – the depth and complexity of the algorithm are exposed to the user of the framework):

Getting started with Tensorflow might have been even easier – instead of building the graph ourselves, we could have used skflow, which is a scikit-like interface for simpler networks. Again, my goal was to get started with arbitrary deep network models, thus, I wanted to experience the full API.