Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Forecasting Time Series Data with Facebook Prophet

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

Product type Book
Published in Mar 2021
Publisher Packt
ISBN-13 9781800568532
Pages 270 pages
Edition 1st Edition
Languages
Author (1):
Greg Rafferty Greg Rafferty
Profile icon Greg Rafferty

Table of Contents (18) Chapters

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

Creating the Prophet performance metrics DataFrame

Now that you've learned what the different options are for performance metrics in Prophet, let's start coding and see how to access these. We'll use the same online retail sales data we used in Chapter 11, Cross-Validation. Along with our usual imports, we are going to add the performance_metrics function from Prophet's diagnostics package and the plot_cross_validation_metric function from the plot package:

import pandas as pd
import matplotlib.pyplot as plt
from fbprophet import Prophet
from fbprophet.plot import add_changepoints_to_plot
from fbprophet.diagnostics import cross_validation
from fbprophet.diagnostics import performance_metrics
from fbprophet.plot import plot_cross_validation_metric

Next, let's load the data, create our forecast, and plot the results:

df = pd.read_csv('online_retail.csv')
df.columns = ['ds', 'y']
model = Prophet(yearly_seasonality=4)
model...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}