Menu
Facebook releases 'Prophet' -- its free forecasting tools -- for Python and R

Facebook releases 'Prophet' -- its free forecasting tools -- for Python and R

The code is available on GitHub

Facebook has open-sourced its Prophet forecasting tool, designed "to make it easier for experts and non-experts to make high-quality forecasts," according to a blog post by Sean J. Taylor and Ben Letham in the company's research team. "Forecasts are customizable in ways that are intuitive to non-experts," they wrote.

The code is available on GitHub in both Python and R.

Prophet is aimed specifically at business problems such as computer infrastructure capacity planning that have at least several months of data (preferably a year or more) and issues such as seasonality, "holidays" that can affect trends (such as Black Friday and Cyber Monday for retailers), and events that can have significant impacts (such as launching a new website when trying to forecast site traffic). Prophet can also handle some missing values and outliers, the blog post said.

Facebook suggests taking Prophet for a spin using page views from a Wikipedia page, data which is currently available on tools.wmflabs.org/pageviews. In R, data needs to be set up so it has two columns: one named ds containing dates, and the other with numerical data. The sample -- forecasting pageviews for Peyton Manning's Wikipedia page - changed the numerical data to a log scale with R's log() function. Basic Prophet forecasting steps:

  • A command such as my_model <- prophet(mydata) fits a model;
  • my_future <- make_future_dataframe(my_model, periods = 365) starts a data frame with an appropriate date column for both past and to-be-predicted dates;
  • my_forecast <- predict(my_model, my_future_df) generates the forecast;
  • plot(my_model, my_forecast) visualizes the forecast; and
  • prophet_plot_components(my_model, my_forecast) graphs trend and seasonal components of the forecast.
Sample plot of trends and seasonality Screenshot of graphic created by Facebook's Prophet tool

Sample plot of trends and seasonality using Facebook's Prophet in R.

To include holidays and other special events, you'd create a new data frame with a ds column for dates and a holiday column with the name of the holiday. That information can be included in the initial model with my_model <- Prophet(my_data, holidays = my_holidays). There's more about holidays in Prophet in the documentation.

Prophet was built using Stan, a probability programming language that connects with several popular analytics platforms such as MATLAB and Stata in addition to Python and R.

Join the CIO Australia group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags FacebookR Language

More about FacebookMATLABProphetWikipedia

Show Comments
[]