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 Good Gear Guide 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

Matthew Stivala

HP OfficeJet 250 Mobile Printer

The HP OfficeJet 250 Mobile Printer is a great device that fits perfectly into my fast paced and mobile lifestyle. My first impression of the printer itself was how incredibly compact and sleek the device was.

Armand Abogado

HP OfficeJet 250 Mobile Printer

Wireless printing from my iPhone was also a handy feature, the whole experience was quick and seamless with no setup requirements - accessed through the default iOS printing menu options.

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?