Reader small image

You're reading from  Forecasting Time Series Data with Facebook Prophet

Product typeBook
Published inMar 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800568532
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Greg Rafferty
Greg Rafferty
author image
Greg Rafferty

Greg Rafferty is a data scientist in San Francisco, California. With over a decade of experience, he has worked with many of the top firms in tech, including Google, Facebook, and IBM. Greg has been an instructor in business analytics on Coursera and has led face-to-face workshops with industry professionals in data science and analytics. With both an MBA and a degree in engineering, he is able to work across the spectrum of data science and communicate with both technical experts and non-technical consumers of data alike.
Read more about Greg Rafferty

Right arrow

Correcting outliers that cause wide uncertainty intervals

In the first type of outlier we looked at, the problem was that the seasonality was affected and forever changed yhat in the forecast (if you remember from Chapter 2, Getting Started with Facebook Prophet, yhat is the predicted value for future dates contained in Prophet's forecast DataFrame). In this second problem, yhat is minimally affected but the uncertainty intervals widen dramatically.

To simulate this issue, we need to modify our NatGeo data a bit. Let's say that Instagram introduced a bug in their code that capped likes to 100,000 per post. It somehow went unnoticed for a year before being fixed, but unfortunately, all likes above 100,000 were lost. Such an error would look like this:

Figure 9.6 – Capped likes on National Geographic's Instagram account

You can simulate this new dataset yourself with the following code:

df3 = df.copy()
df3.loc[df3['ds'].dt...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Forecasting Time Series Data with Facebook Prophet
Published in: Mar 2021Publisher: PacktISBN-13: 9781800568532

Author (1)

author image
Greg Rafferty

Greg Rafferty is a data scientist in San Francisco, California. With over a decade of experience, he has worked with many of the top firms in tech, including Google, Facebook, and IBM. Greg has been an instructor in business analytics on Coursera and has led face-to-face workshops with industry professionals in data science and analytics. With both an MBA and a degree in engineering, he is able to work across the spectrum of data science and communicate with both technical experts and non-technical consumers of data alike.
Read more about Greg Rafferty