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 newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection

Tags R LanguageFacebook

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Sharon Machlis

Computerworld (US)
Show Comments

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Ben Ramsden

Sharp PN-40TC1 Huddle Board

Brainstorming, innovation, problem solving, and negotiation have all become much more productive and valuable if people can easily collaborate in real time with minimal friction.

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

David Coyle

Brother PocketJet PJ-773 A4 Portable Thermal Printer

I rate the printer as a 5 out of 5 stars as it has been able to fit seamlessly into my busy and mobile lifestyle.

Kurt Hegetschweiler

Brother PocketJet PJ-773 A4 Portable Thermal Printer

It’s perfect for mobile workers. Just take it out — it’s small enough to sit anywhere — turn it on, load a sheet of paper, and start printing.

Featured Content

Product Launch Showcase

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?