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 FacebookR Language

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

Sharon Machlis

Computerworld (US)
Show Comments

Cool Tech

Breitling Superocean Heritage Chronographe 44

Learn more >

SanDisk MicroSDXC™ for Nintendo® Switch™

Learn more >

Toys for Boys

Family Friendly

Panasonic 4K UHD Blu-Ray Player and Full HD Recorder with Netflix - UBT1GL-K

Learn more >

Stocking Stuffer

Razer DeathAdder Expert Ergonomic Gaming Mouse

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Edwina Hargreaves

WD My Cloud Home

I would recommend this device for families and small businesses who want one safe place to store all their important digital content and a way to easily share it with friends, family, business partners, or customers.

Walid Mikhael

Brother QL-820NWB Professional Label Printer

It’s easy to set up, it’s compact and quiet when printing and to top if off, the print quality is excellent. This is hands down the best printer I’ve used for printing labels.

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

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?