Forecasting Time Series Data with Facebook Prophet
eBook - ePub

Forecasting Time Series Data with Facebook Prophet

Greg Rafferty

  1. 270 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Forecasting Time Series Data with Facebook Prophet

Greg Rafferty

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Informazioni sul libro

Create and improve high-quality automated forecasts for time series data that have strong seasonal effects, holidays, and additional regressors using PythonKey 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 statisticsBook DescriptionProphet 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.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 modelsWho this book is forThis 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.

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Forecasting Time Series Data with Facebook Prophet è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Forecasting Time Series Data with Facebook Prophet di Greg Rafferty in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Computer Science e Data Processing. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2021
ISBN
9781800566521
Edizione
1

Section 1: Getting Started

The first part of this book will give you an understanding of the historical developments in time series forecasting techniques that led to the inception of Prophet and then guide you through the installation of the program. The section closes with a walk-through of a basic Prophet forecasting model and introduces the output that such a model produces.
This section comprises the following chapters:
  • Chapter 1, The History and Development of Time Series Forecasting
  • Chapter 2, Getting Started with Facebook Prophet

Chapter 1: The History and Development of Time Series Forecasting

Facebook Prophet is a powerful tool for creating, visualizing, and optimizing your forecasts! With Prophet, you'll be able to understand what factors will drive your future results and enable you to make more confident decisions. You'll accomplish these tasks and goals through an intuitive but very flexible programming interface that is designed for both the beginner and expert alike.
You don't need a deep knowledge of the math or statistics behind time series forecasting techniques to leverage the power of Prophet, although if you do possess this knowledge, Prophet includes a rich feature set that allows you to deploy your experience to great effect. You'll be working in a structured paradigm where each problem follows the same pattern, allowing you to spend less time figuring out how to optimize your forecast and more time discovering key insights to supercharge your decisions.
This chapter introduces the foundational ideas behind time series forecasting and discusses some of the key model iterations that eventually led to the development of Prophet. In this chapter, you'll learn what time series data is and why it must be handled differently than non-time series data, and then you'll discover the most powerful innovations, of which Prophet is the latest. Specifically, we will cover an overview of what time series forecasting is and then go into more detail on some specific approaches:
  • Understanding time series forecasting
  • Moving average and exponential smoothing
  • ARIMA
  • ARCH/GARCH
  • Neural networks
  • Prophet

Understanding time series forecasting

A time series is a set of data collected sequentially over time. For example, think of any chart where the x-axis is some measurement of time—anything from the number of stars in the Universe since the Big Bang until today or the amount of energy released each nanosecond of a nuclear reaction. The data behind both are time series. The chart in the weather app on your phone showing the expected temperature for the next 7 days? That's also the plot of a time series.
In this book, we are mostly concerned with events on the human scales of years, months, days, and hours, but all of this is time series data. Predicting future values is the act of forecasting.
Forecasting the weather has obviously been important to humans for millennia, particularly since the advent of agriculture. In fact, over 2,300 years ago, the Greek philosopher Aristotle wrote a treatise called Meteorology that contained a discussion of early weather forecasting. The very word forecast was coined by an English meteorologist in the 1850s, Robert FitzRoy, who achieved fame as the captain of the HMS Beagle during Charles Darwin's pioneering voyage.
But time series data is not unique to weather. The field of medicine adopted time series analysis techniques with the 1901 invention of the first practical electrocardiogram by the Dutch physician Willem Einthoven. The ECG, as it is commonly known, produces the familiar pattern of heartbeats we now see on the machine next to a patient's bed in every medical drama.
Today, one of the most discussed fields of forecasting is economics. There are entire television channels dedicated to analyzing trends of the stock market. Governments use economic forecasting to advise central bank policy, politicians use economic forecasting to develop their platforms, and business leaders use economic forecasting to guide their decisions.
In this book, we will be forecasting topics as varied as carbon dioxide levels high in the atmosphere, the number of riders on Chicago's public bike share program, the growth of the wolf population in Yellowstone, the solar sunspot cycles, local rainfall, and even Instagram likes on some popular accounts.

The problem with dependent data

So, why does time series forecasting require its own unique approach? From a statistical perspective, you might see a scatter plot of time series with a relatively clear trend and attempt to fit a line using standard regression—the technique for fitting a straight line through data. The problem is that this violates the assumption of independence that linear regression demands.
To illustrate time series dependence with an example, let's say that a gambler is rolling an unbiased die. I tell you that he just rolled a 2 and ask what the next value will be. This data is independent; previous rolls have no effect on future rolls, so knowing that the previous roll was a 2 does not provide any information about the next roll.
However, in a different situation, let's say that I call you from an undisclosed location somewhere on Earth and ask you to guess the temperature at my location. Your best bet would be to guess some average global temperature for that day. But now, imagine that I tell you that yesterday's temperature at my location was 90°F. That provides a great deal of information to you because you intuitively know that yesterday's temperature and today's temperature are linked in some way; they are not independent.
With time series data, you cannot randomly shuffle the order of data around without disturbing the trends, within a reasonable margin of error. The order of the data matters; it is not independent. When data is dependent like this, a regression model can show statistical significance by random chance, even when there is no true correlation, much more often than your chosen confidence level would suggest.
Because high values tend to follow high values and low values tend to follow low values, a time series dataset is more likely to show more clusters of high or low values than would otherwise be present, and this in turn can lead to the appearance of more correlations than would otherwise be present.
The website Spurious Correlations by Tyler Vigen specializes in pointing out examples of seemingly significant, but utterly ridiculous, time series correlations. Here is one example:
Figure 1.1 – A spurious time series correlation. https://www.tylervigen.com/spurious-correlations
Figure 1.1 – A spurious time series correlation. https://www.tylervigen.com/spurious-correlations
Obviously, the number of people who drown in pools each year is completely independent of the number of films Nicolas Cage appears in. They simply have no effect on each other at all. However, by making the fallacy of treating time series data as if it were independent, Vigen has shown that by pure random chance, the two series of data do, in fact, correlate significantly. These types of random chances are much more likely to happen when ignoring the dependence of time series data.
Now that you understand what exactly time series data is and what sets it apart from other datasets, let's look at a few milestones in the development of models, from the earliest models up to Prophet.

Moving average and exponential smoothing

Possibly the simplest form of forecasting is the moving average. Often, a moving average is used as a smoothing technique to find a straighter line through data with a lot of variation. Each data point is adjusted to the value of the average of n surrounding data points, with n being referred to as the window size. With a window size of 10, for example, we would adjust a data point to be the average of the 5 values before and the 5 values after. In a forecasting setting, the future values are calculated as the average of the n previous values, so again, with a window size of 10, this means the average of the 10 previous values.
The balancing act with a moving average is that you want a large window size in order to smooth out the noise and capture the actual trend, but with a larger window size, your forecasts are going to lag the trend significantly as you re...

Indice dei contenuti

  1. Forecasting Time Series Data with Facebook Prophet
  2. Contributors
  3. Preface
  4. Section 1: Getting Started
  5. Chapter 1: The History and Development of Time Series Forecasting
  6. Chapter 2: Getting Started with Facebook Prophet
  7. Section 2: Seasonality, Tuning, and Advanced Features
  8. Chapter 3: Non-Daily Data
  9. Chapter 4: Seasonality
  10. Chapter 5: Holidays
  11. Chapter 6: Growth Modes
  12. Chapter 7: Trend Changepoints
  13. Chapter 8: Additional Regressors
  14. Chapter 9: Outliers and Special Events
  15. Chapter 10: Uncertainty Intervals
  16. Section 3: Diagnostics and Evaluation
  17. Chapter 11: Cross-Validation
  18. Chapter 12: Performance Metrics
  19. Chapter 13: Productionalizing Prophet
  20. Other Books You May Enjoy
Stili delle citazioni per Forecasting Time Series Data with Facebook Prophet

APA 6 Citation

Rafferty, G. (2021). Forecasting Time Series Data with Facebook Prophet (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/2352510/forecasting-time-series-data-with-facebook-prophet-pdf (Original work published 2021)

Chicago Citation

Rafferty, Greg. (2021) 2021. Forecasting Time Series Data with Facebook Prophet. 1st ed. Packt Publishing. https://www.perlego.com/book/2352510/forecasting-time-series-data-with-facebook-prophet-pdf.

Harvard Citation

Rafferty, G. (2021) Forecasting Time Series Data with Facebook Prophet. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/2352510/forecasting-time-series-data-with-facebook-prophet-pdf (Accessed: 15 October 2022).

MLA 7 Citation

Rafferty, Greg. Forecasting Time Series Data with Facebook Prophet. 1st ed. Packt Publishing, 2021. Web. 15 Oct. 2022.