Book Image

Forecasting Time Series Data with Facebook Prophet

By : Greg Rafferty
Book Image

Forecasting Time Series Data with Facebook Prophet

By: Greg Rafferty

Overview of this book

Prophet enables Python and R developers to build scalable time series forecasts. This book will help you to implement Prophet’s cutting-edge forecasting techniques to model future data with higher accuracy and with very few lines of code. You will begin by exploring the evolution of time series forecasting, from the basic early models to the advanced models of the present day. The book will demonstrate how to install and set up Prophet on your machine and build your first model with only a few lines of code. You'll then cover advanced features such as visualizing your forecasts, adding holidays, seasonality, and trend changepoints, handling outliers, and more, along with understanding why and how to modify each of the default parameters. Later chapters will show you how to optimize more complicated models with hyperparameter tuning and by adding additional regressors to the model. Finally, you'll learn how to run diagnostics to evaluate the performance of your models and see some useful features when running Prophet in production environments. By the end of this Prophet book, you will be able to take a raw time series dataset and build advanced and accurate forecast models with concise, understandable, and repeatable code.
Table of Contents (18 chapters)
1
Section 1: Getting Started
4
Section 2: Seasonality, Tuning, and Advanced Features
13
Section 3: Diagnostics and Evaluation

To get the most out of this book

To run the code examples in this book, you will need Python 3.x installed. All examples in this book were made using Prophet version 0.71 in Jupyter Notebooks. MacOS, Windows, and Linux are all supported. Although all examples in this book will be written in Python, everything is also fully compatible with R and you may use that language if you prefer, although this book will not cover R syntax. Please refer to the official Prophet documentation for R syntax (https://facebook.github.io/prophet/).

Chapter 2, Getting Started with Facebook Prophet will walk you through installing Facebook Prophet, and installing either Anaconda or Miniconda is strongly recommended in order to correctly install all of Prophet's dependencies. It is possible to install Prophet without using Anaconda, but it can be very difficult depending upon the specific configuration of your machine, and this book will assume Anaconda will be used.

In order to follow the examples, you must at least be familiar with the pandas library for data processing and Matplotlib for making plots. In a few cases, the numpy library will be used to simulate random data but following the examples will not require that you know the NumPy syntax. All of these libraries will be installed automatically as Prophet dependencies, if not already installed. All datasets are hosted and can be downloaded from this book's GitHub repo here: https://github.com/PacktPublishing/Forecasting-Time-Series-Data-with-Facebook-Prophet.

Prophet supports parallelization with Dask but, while setting Prophet up to run on a Dask cluster will be covered, installing and using Dask is beyond the scope of this book. Similarly, this book will cover how to build interactive Prophet visualizations in Plotly but putting those together into a Dash dashboard will be left up to the reader to learn elsewhere.

If you are using the digital version of this book, we advise you to type the code yourself or access the code via the GitHub repository (link available in the next section). Doing so will help you avoid any potential errors related to copy/pasting of code.