Learn how to apply the principles of machine learning to time series modeling with this indispensable resource
Machine Learning for Time Series Forecasting with Python is an incisive and straightforward examination of one of the most crucial elements of decision-making in finance, marketing, education, and healthcare: time series modeling.
Despite the centrality of time series forecasting, few business analysts are familiar with the power or utility of applying machine learning to time series modeling. Author Francesca Lazzeri, a distinguished machine learning scientist and economist, corrects that deficiency by providing readers with comprehensive and approachable explanation and treatment of the application of machine learning to time series forecasting.
Written for readers who have little to no experience in time series forecasting or machine learning, the book comprehensively covers all the topics necessary to:
- Understand time series forecasting concepts, such as stationarity, horizon, trend, and seasonality
- Prepare time series data for modeling
- Evaluate time series forecasting models’ performance and accuracy
- Understand when to use neural networks instead of traditional time series models in time series forecasting
Machine Learning for Time Series Forecasting with Python is full real-world examples, resources and concrete strategies to help readers explore and transform data and develop usable, practical time series forecasts.
Perfect for entry-level data scientists, business analysts, developers, and researchers, this book is an invaluable and indispensable guide to the fundamental and advanced concepts of machine learning applied to time series modeling.
Table of Contents
Acknowledgments vii
Introduction xv
Chapter 1 Overview of Time Series Forecasting 1
Flavors of Machine Learning for Time Series Forecasting 3
Supervised Learning for Time Series Forecasting 14
Python for Time Series Forecasting 21
Experimental Setup for Time Series Forecasting 24
Conclusion 26
Chapter 2 How to Design an End-to-End Time Series Forecasting Solution on the Cloud 29
Time Series Forecasting Template 31
Business Understanding and Performance Metrics 33
Data Ingestion 36
Data Exploration and Understanding 39
Data Pre-processing and Feature Engineering 40
Modeling Building and Selection 42
An Overview of Demand Forecasting Modeling Techniques 44
Model Evaluation 46
Model Deployment 48
Forecasting Solution Acceptance 53
Use Case: Demand Forecasting 54
Conclusion 58
Chapter 3 Time Series Data Preparation 61
Python for Time Series Data 62
Common Data Preparation Operations for Time Series 65
Time stamps vs. Periods 66
Converting to Timestamps 69
Providing a Format Argument 70
Indexing 71
Time/Date Components 76
Frequency Conversion 78
Time Series Exploration and Understanding 79
How to Get Started with Time Series Data Analysis 79
Data Cleaning of Missing Values in the Time Series 84
Time Series Data Normalization and Standardization 86
Time Series Feature Engineering 89
Date Time Features 90
Lag Features and Window Features 92
Rolling Window Statistics 95
Expanding Window Statistics 97
Conclusion 98
Chapter 4 Introduction to Autoregressive and Automated Methods for Time Series Forecasting 101
Autoregression 102
Moving Average 119
Autoregressive Moving Average 120
Autoregressive Integrated Moving Average 122
Automated Machine Learning 129
Conclusion 136
Chapter 5 Introduction to Neural Networks for Time Series Forecasting 137
Reasons to Add Deep Learning to Your Time Series Toolkit 138
Deep Learning Neural Networks Are Capable of Automatically Learning and Extracting Features from Raw and Imperfect Data 140
Deep Learning Supports Multiple Inputs and Outputs 142
Recurrent Neural Networks Are Good at Extracting Patterns from Input Data 143
Recurrent Neural Networks for Time Series Forecasting 144
Recurrent Neural Networks 145
Long Short-Term Memory 147
Gated Recurrent Unit 148
How to Prepare Time Series Data for LSTMs and GRUs 150
How to Develop GRUs and LSTMs for Time Series Forecasting 154
Keras 155
TensorFlow 156
Univariate Models 156
Multivariate Models 160
Conclusion 164
Chapter 6 Model Deployment for Time Series Forecasting 167
Experimental Set Up and Introduction to Azure Machine Learning SDK for Python 168
Workspace 169
Experiment 169
Run 169
Model 170
Compute Target, RunConfiguration, and ScriptRun Config 171
Image and Webservice 172
Machine Learning Model Deployment 173
How to Select the Right Tools to Succeed with Model Deployment 175
Solution Architecture for Time Series Forecasting with Deployment Examples 177
Train and Deploy an ARIMA Model 179
Configure the Workspace 182
Create an Experiment 183
Create or Attach a Compute Cluster 184
Upload the Data to Azure 184
Create an Estimator 188
Submit the Job to the Remote Cluster 188
Register the Model 189
Deployment 189
Define Your Entry Script and Dependencies 190
Automatic Schema Generation 191
Conclusion 196
References 197
Index 199