Deep Learning with Python, Third Edition cover
welcome to this free extract from
an online version of the Manning book.
to read more
or

13 Timeseries forecasting

 

This chapter covers

  • An overview of machine learning for timeseries
  • Understanding Recurrent Neural Networks (RNNs)
  • Applying RNNs to a temperature forecasting example

13.1 Different kinds of timeseries tasks

A timeseries 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. Timeseries 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 timeseries 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 timeseries-related task is forecasting: predicting what happens next in the series. Forecast electricity consumption a few hours in advance so you can anticipate demand, forecast revenue a few months in advance so you can plan your budget, forecast 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 timeseries, such as:

13.2 A temperature forecasting example

13.3 Preparing the data

13.4 A common-sense, non-machine-learning baseline

13.5 Let’s try a basic machine learning model

13.6 Let’s try a 1D convolutional model

13.7 Recurrent neural networks

13.7.1 Understanding recurrent neural networks

13.8 A recurrent layer in Keras

13.9 Getting the most out of recurrent neural networks

13.10 Using recurrent dropout to fight overfitting

13.11 Stacking recurrent layers

13.12 Using bidirectional RNNs

13.13 Going even further

13.14 Chapter summary