Book Image

Deep Learning for Time Series Cookbook

By : Vitor Cerqueira, Luís Roque
Book Image

Deep Learning for Time Series Cookbook

By: Vitor Cerqueira, Luís Roque

Overview of this book

Most organizations exhibit a time-dependent structure in their processes, including fields such as finance. By leveraging time series analysis and forecasting, these organizations can make informed decisions and optimize their performance. Accurate forecasts help reduce uncertainty and enable better planning of operations. Unlike traditional approaches to forecasting, deep learning can process large amounts of data and help derive complex patterns. Despite its increasing relevance, getting the most out of deep learning requires significant technical expertise. This book guides you through applying deep learning to time series data with the help of easy-to-follow code recipes. You’ll cover time series problems, such as forecasting, anomaly detection, and classification. This deep learning book will also show you how to solve these problems using different deep neural network architectures, including convolutional neural networks (CNNs) or transformers. As you progress, you’ll use PyTorch, a popular deep learning framework based on Python to build production-ready prediction solutions. By the end of this book, you'll have learned how to solve different time series tasks with deep learning using the PyTorch ecosystem.
Table of Contents (12 chapters)

What this book covers

Chapter 1, Getting Started with Time Series, introduces the main concepts behind time series. The chapter starts by defining a time series and describing how it can represent several real-world systems. Then, we explore the main features of time series data, including trend or seasonality. You’ll also learn about several methods and techniques for time series analysis.

Chapter 2, Getting Started with PyTorch, provides an overview of how to use PyTorch to develop deep learning models in Python. We start by guiding you through the installation process of PyTorch, including how to set up the appropriate environment. This is followed by an introduction to defining a neural network structure in PyTorch, including the definition of layers and activation functions. Afterward, we walk through the process of training a neural network. By the end of the chapter, you will understand the fundamentals of using PyTorch for deep learning and be ready to tackle forecasting tasks with these new skills.

Chapter 3, Univariate Time Series Forecasting, focuses on using PyTorch to develop deep learning forecasting models for univariate time series. We begin by guiding you through preparing a time series for supervised learning. After that, we introduce different types of neural networks, including feed-forward, recurrent, and convolutional neural networks. We explain how they can be trained and how we can use them to tackle time series forecasting problems. We also cover common time series issues, such as trend and seasonality, and how to incorporate them into neural network models.

Chapter 4, Forecasting with PyTorch Lightning, explores the PyTorch Lightning ecosystem and how to use it to build neural networks using time series. You’ll learn about data modules and data loaders, and how these can help you accelerate the process of building forecasting models. We also explore TensorBoard and callbacks, which are useful to drive the training process.

Chapter 5, Global Forecasting Models, describes how to handle forecasting problems involving collections of time series. You’ll also learn about the intricacies of particular problems in forecasting, such as multi-step ahead predictions and predictions for multiple variables. Finally, we’ll also explore how to optimize the parameters of a neural network using Ray Tune.

Chapter 6, Advanced Deep Learning Architectures for Time Series Forecasting, provides a comprehensive guide to using state-of-the-art architectures for time series forecasting. We cover how to train several models, such as DeepAR, N-BEATS, and TFT. Additionally, we explain each model’s architecture and inner workings and how to apply them to specific forecasting problems.

Chapter 7, Probabilistic Time Series Forecasting, describes how to use deep learning for probabilistic time series forecasting. We introduce the concept of probabilistic forecasting and the key differences compared to traditional point forecasting. The chapter gives several examples of probabilistic forecasting problems that can be tackled using specific deep learning architectures.

Chapter 8, Deep Learning for Time Series Classification, focuses on using deep learning to tackle time series classification problems. The chapter introduces the concept of time series classification, which involves assigning a class label to a time series. We show how to tackle time series classification problems with different deep learning architectures, including residual and convolutional neural networks.

Chapter 9, Deep Learning for Time Series Anomaly Detection, gives an overview of how to use deep learning to detect abnormal patterns in a time series. For this use case, we introduce generative adversarial networks and auto-encoders, which are popular approaches to detecting anomalies in time series.