Member-only story

Create Sales Forecast with Prophet

How to Create a Forecast using Prophet

Sung Kim
9 min readApr 19, 2022

This is a tutorial on how to create a forecast using Prophet. Forecasting is a process of making predictions of the future based on past data and its trends. The accuracy of the forecast decreases as you stretch out your forecast. For example, if you are forecasting monthly sales then the accuracy of the forecast for the month 1 sales forecast will be higher than the month 2 sales forecast, and so on. One of my co-workers likes to state that the best way to predict tomorrow’s weather is to assume it is similar to today’s weather (i.e., Markov Chain). Everything else is just a guess.

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 per Prophet website (https://facebook.github.io/prophet/).

To maintain the brevity of a tutorial, some of the important steps are not referenced in this tutorial. For a complete code walk-through, please refer to the Github repository referenced in the Resource section at the end of this tutorial. This tutorial was created for me as reference material, therefore the tutorial is heavy on how-to, not on algorithms.

Prerequisites

The following are prerequisites for this tutorial:

  • Data

Data

United States Census Bureau Monthly Retail Sales was used for this tutorial to forecast retail sales.

United States Census Bureau Monthly Retail Sales
United States Census Bureau maintains Monthly Retail Trade Report, from January 1992 to the present. This data was picked to illustrate forecasting because it has extensive historical data with the same monthly frequency. Data is available in Excel spreadsheet format at https://www.census.gov/retail/mrts/www/mrtssales92-present.xls from United States Census Bureau (https://www.census.gov).

Tutorial

The tutorial is divided into the following steps:

1. Prep 
a. Python Packages
b. Import Retail Sales Data
c. Cleanse and Transform Retail Sales Data to…

--

--

Sung Kim
Sung Kim

Written by Sung Kim

A business analyst at heart who dabbles in ai engineering, machine learning, data science, and data engineering. threads: @sung.kim.mw

No responses yet

Write a response