Prophet: How Facebook operationalizes time series forecasting at scale

[This article was first published on Revolutions, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Facebook is a famously data-driven organization, and an important goal in any data science activity is forecasting. Now, Facebook has released Prophet, an open-source package for R and Python that implements the time-series methodology that Facebook uses in production for forecasting at scale.

Prophet has a very simple interface: you pass it a column of dates and a column of numbers, and is produces a forecast for the time series, like this:

Prophet forecast

The black dots are the number of views of Peyton Manning's Wikipedia page through the end of 2016; the blue region is a forecast (with uncertainty interval) into 2017. As you can see, the Prophet forecast automatically detects the seasonal cycles (presumably related to NFL seasons). The prophet function also provides options to explicitly model weekly and/or yearly seasonality, account for holidays, and to specify changepoints where discontinuities in the time series are expected. It also supports modeling logistic growth, where each data point is measured against a maximum possible capacity.

The underlying model behing the forecast is described in this paper. It's not your traditional ARIMA-style time series model. It's closer in spirit to a Bayesian-influenced generalized additive model, a regression of smooth terms. The model is resistant to the effects of outliers, and supports data collected over an irregular time scale (ingliding presence of missing data) without the need for interpolation. The underlying calculation engine is Stan; the R and Python packages simply provide a convenient interface.

Prophet is billed as a platform for “forecasting at scale”, but here “scale” does not refer to data size or computational speed (as we are accustomed to in this domain). As authors Sean Taylor and Ben Letham write in the aforementioned paper:

The actual problems of scale we have observed in practice involve the complexity introduced by the variety of forecasting problems and building trust in a large number of forecasts once they have been produced.

With its simple interface that automates much of the process of finding a “best fit” characterization of a complex time series, Prophet scales easily to a large number of users who need many forecasts of qualitatively many different kinds of data, without in-depth expertise in time series modeling techniques. 

You can find out more about Prophet, including how to install it for R and Python, at the link below.

Facebook Open Source: Prophet

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)