January 10, 2018

Facebook at StanCon 2018

By: Sean Taylor

At Facebook, we rely extensively on statistical methods, e.g., for experimental design and analysis, analysis of time series and other data, and predictive modeling. We are excited to collaborate with and contribute to the broader statistics community with new methodologies, applications, and tools.

Last year we open sourced Prophet, a forecasting procedure designed to help scale high quality forecasts across many people and problems. Since the release, we’ve been overwhelmed by the enthusiastic response from the community — with lots of new contributors helping us improve the project and new users contacting us with interesting applications. We now use Prophet internally at Facebook.

The model underlying the Prophet procedure is implemented using Stan, an open-source platform for statistical modeling developed by the excellent Stan Development Team. The Stan community has blossomed over the last few years and we are proud to be among the early adopters using it in production.

Facebook at StanCon 2018

This week, we are excited to support the Stan Community by attending and sponsoring the StanCon 2018 conference in Pacific Grove, CA, as well as presenting about how we used Stan to help solve forecasting problems at Facebook.

Why we use Stan

Stan performs the MAP optimization for the Prophet model extremely quickly in practice (~1 second) and gives us the option to estimate parameter uncertainty using the Hamiltonian Monte Carlo algorithm. A prior version of Prophet we implemented with backfitting took much longer and did not provide uncertainty estimates. Since Stan has bindings for many languages, it allows us to re-use the model and fitting procedure to provide packages available in both R and Python based on the same Stan code.

The future of Stan & Prophet at Facebook

We are evaluating several additional promising use-cases for Stan at Facebook. Stan allows us to rapidly prototype a model without worrying about how we will fit it to data. Once we’ve verified it works in our application, we can wrap the procedure in another language and deploy it in production, either as a service that responds to requests (e.g. predictions) or as a procedure that processes batch data. Prophet is just the first example of scaling a statistical model across a variety of problems and people and we anticipate there are large opportunities for this kind of impact in the years ahead.