Experimenting on Facebook Prophet

Chris Shayan
5 min readDec 12, 2018

If you have ever worked with time series predictions, I am quite sure you are well aware of the strains and pains that come with them. Time series predictions are difficult and always require a very specialized data scientist to implement it.

Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. It works best with time series that have strong seasonal effects and several seasons of historical data. Prophet is robust to missing data and shifts in the trend, and typically handles outliers well. You can read the paper in here.

So I decided to give a try on a small eCommerce in Vietnam. I have daily data from March to November. I’ve to feed in data like below as a csv format and remember the headers must be ds and y. (case sensitive)

ds,y
1/3/18
,1700000
3/3/18
,2745000
5/3/18
,1665000
6/3/18
,1530000
7/3/18
,2070000
8/3/18
,1665000

I decided to use Prophet for 3 predictions:

  1. Predicting Average Order Value
  2. Predicting number of sold SKUs
  3. Predicting number of Sales Orders

Predicting Average Order Value

Here is the source code:

import pandas as pd

from fbprophet import Prophet
from fbprophet.diagnostics import cross_validation
from fbprophet.diagnostics import performance_metrics

dataFile =…

--

--

Chris Shayan

Head of AI at Backbase The postings on this site are my own and do not necessarily represent the postings, strategies or opinions of my employer.