10 Deep learning for time series

 

This chapter covers:

  • Examples of machine learning tasks that involve time-series data
  • Understanding recurrent neural networks (RNNs)
  • Applying RNNs to a temperature-forecasting example
  • Advanced RNN usage patterns

10.1 Different kinds of time-series tasks

A time series can be any data obtained via measurements at regular intervals, like the daily price of a stock, the hourly electricity consumption of a city, or the weekly sales of a store. Time series are everywhere, whether we’re looking at natural phenomena (like seismic activity, the evolution of fish populations in a river, or the weather at a location) or human activity patterns (like visitors to a website, a country’s GDP, or credit card transactions). Unlike the types of data you’ve encountered so far, working with time series involves understanding the dynamics of a system—its periodic cycles, how it trends over time, its regular regime, and its sudden spikes.

By far, the most common time-series-related task is forecasting: predicting what will happen next in a series; forecasting electricity consumption a few hours in advance so you can anticipate demand; forecasting revenue a few months in advance so you can plan your budget; forecasting the weather a few days in advance so you can plan your schedule. Forecasting is what this chapter focuses on. But there’s actually a wide range of other things you can do with time series:

10.2 A temperature-forecasting example

10.2.1 Preparing the data

10.2.2 A common-sense, non–machine learning baseline

10.2.3 Let’s try a basic machine learning model

10.2.4 Let’s try a 1D convolutional model

10.2.5 A first recurrent baseline

10.3 Understanding recurrent neural networks

10.3.1 A recurrent layer in Keras

10.4 Advanced use of recurrent neural networks

10.4.1 Using recurrent dropout to fight overfitting

10.4.2 Stacking recurrent layers

10.4.3 Using bidirectional RNNs

10.4.4 Going even further

Summary