Chapter 8. Recurrent Neural Networks

History never repeats itself, but it rhymes.

Mark Twain (probably)

My life seemed to be a series of events and accidents. Yet when I look back, I see a pattern.

Bernoît Mandelbrot

This chapter is about recurrent neural networks (RNNs). This type of network is specifically designed to learn about sequential data, such as text or time series data. The discussion in this chapter takes, as before, a practical approach and relies mainly on worked-out Python examples, making use of Keras.1

“First Example” and “Second Example” introduce RNNs on the basis of two simple examples with sample numerical data. The application of RNNs to predict sequential data is illustrated. “Financial Price Series” then works with financial price series data and applies the RNN approach to predict such a series directly via estimation. “Financial Return Series” then works with returns data to predict the future direction of the price of a financial instrument also via an estimation approach. “Financial Features” adds financial features to the mix—in addition to price and return data—to predict the market direction. Three different approaches are illustrated in this section: prediction via a shallow RNN for both estimation and classification, as well as prediction via a deep RNN for classification.

The chapter shows that the application of RNNs to financial time series data can achieve a prediction accuracy of well above 60% out-of-sample in the context of directional ...

Get Artificial Intelligence in Finance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.