0%

Create and improve high-quality automated forecasts for time series data that have strong seasonal effects, holidays, and additional regressors using Python

Key Features

  • Learn how to use the open-source forecasting tool Facebook Prophet to improve your forecasts
  • Build a forecast and run diagnostics to understand forecast quality
  • Fine-tune models to achieve high performance, and report that performance with concrete statistics

Book Description

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 fi rst 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.

What you will learn

  • Gain an understanding of time series forecasting, including its history, development, and uses
  • Understand how to install Prophet and its dependencies
  • Build practical forecasting models from real datasets using Python
  • Understand the Fourier series and learn how it models seasonality
  • Decide when to use additive and when to use multiplicative seasonality
  • Discover how to identify and deal with outliers in time series data
  • Run diagnostics to evaluate and compare the performance of your models

Who this book is for

This book is for data scientists, data analysts, machine learning engineers, software engineers, project managers, and business managers who want to build time series forecasts in Python. Working knowledge of Python and a basic understanding of forecasting principles and practices will be useful to apply the concepts covered in this book more easily.

Table of Contents

  1. Forecasting Time Series Data with Facebook Prophet
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  6. Section 1: Getting Started
  7. Chapter 1: The History and Development of Time Series Forecasting
    1. Understanding time series forecasting
    2. The problem with dependent data
    3. Moving average and exponential smoothing
    4. ARIMA
    5. ARCH/GARCH
    6. Neural networks
    7. Prophet
    8. Summary
  8. Chapter 2: Getting Started with Facebook Prophet
    1. Technical requirements
    2. Installing Prophet
    3. Installation on macOS
    4. Installation on Windows
    5. Installation on Linux
    6. Building a simple model in Prophet
    7. Interpreting the forecast DataFrame
    8. Understanding components plots
    9. Summary
  9. Section 2: Seasonality, Tuning, and Advanced Features
  10. Chapter 3: Non-Daily Data
    1. Technical requirements
    2. Using monthly data
    3. Using sub-daily data
    4. Using data with regular gaps
    5. Summary
  11. Chapter 4: Seasonality
    1. Technical requirements
    2. Understanding additive versus multiplicative seasonality
    3. Controlling seasonality with Fourier order
    4. Adding custom seasonalities
    5. Adding conditional seasonalities
    6. Regularizing seasonality
    7. Global seasonality regularization
    8. Local seasonality regularization
    9. Summary
  12. Chapter 5: Holidays
    1. Technical requirements
    2. Adding default country holidays
    3. Adding default state/province holidays
    4. Creating custom holidays
    5. Creating multi-day holidays
    6. Regularizing holidays
    7. Global holiday regularization
    8. Individual holiday regularization
    9. Summary
  13. Chapter 6: Growth Modes
    1. Technical requirements
    2. Applying linear growth
    3. Understanding the logistic function
    4. Saturating forecasts
    5. Increasing logistic growth
    6. Non-constant cap
    7. Decreasing logistic growth
    8. Applying flat growth
    9. Summary
  14. Chapter 7: Trend Changepoints
    1. Technical requirements
    2. Automatic trend changepoint detection
    3. Default changepoint detection
    4. Regularizing changepoints
    5. Specifying custom changepoint locations
    6. Summary
  15. Chapter 8: Additional Regressors
    1. Technical requirements
    2. Adding binary regressors
    3. Adding continuous regressors
    4. Interpreting the regressor coefficients
    5. Summary
  16. Chapter 9: Outliers and Special Events
    1. Technical requirements
    2. Correcting outliers that cause seasonality swings
    3. Correcting outliers that cause wide uncertainty intervals
    4. Detecting outliers automatically
    5. Winsorizing
    6. Standard deviation
    7. Moving average
    8. Error standard deviation
    9. Modeling outliers as special events
    10. Summary
  17. Chapter 10: Uncertainty Intervals
    1. Technical requirements
    2. Modeling uncertainty in trends
    3. Modeling uncertainty in seasonality
    4. Summary
  18. Section 3: Diagnostics and Evaluation
  19. Chapter 11: Cross-Validation
    1. Technical requirements
    2. Performing k-fold cross-validation
    3. Performing forward-chaining cross-validation
    4. Creating the Prophet cross-validation DataFrame
    5. Parallelizing cross-validation
    6. Summary
  20. Chapter 12: Performance Metrics
    1. Technical requirements
    2. Understanding Prophet's metrics
    3. Mean squared error
    4. Root mean squared error
    5. Mean absolute error
    6. Mean absolute percent error
    7. Median absolute percent error
    8. Coverage
    9. Choosing the best metric
    10. Creating the Prophet performance metrics DataFrame
    11. Handling irregular cut-offs
    12. Tuning hyperparameters with grid search
    13. Summary
  21. Chapter 13: Productionalizing Prophet
    1. Technical requirements
    2. Saving a model
    3. Updating a fitted model
    4. Making interactive plots with Plotly
    5. Plotly forecast plot
    6. Plotly components plot
    7. Plotly single component plot
    8. Plotly seasonality plot
    9. Summary
    10. Why subscribe?
  22. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Leave a review - let other readers know what you think
18.226.177.223