Experimenting on Facebook Prophet
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:
- Predicting Average Order Value
- Predicting number of sold SKUs
- 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 =…