This course spans 12 weeks, covering fundamental to advanced forecasting techniques. Week 6 focuses on Prophet, a powerful tool for business forecasting.
By the end of this lesson, you will be able to:
| 1 | Analyse the Prophet forecasting method and understand its core components |
|---|---|
| 2 | Analyse and apply model evaluation metrics (RMSE, MAPE, MSE) |
| 3 | Understand model selection criteria using information criteria (AIC, BIC) |
Prophet is widely used in industry for business forecasting. Understanding how to implement, evaluate, and select forecasting models is essential for making data-driven business decisions.
Before introducing Prophet, let us review the forecasting methods covered in previous weeks. Each method has specific strengths and ideal use cases.
Uses the last observation as the forecast
Averages the last k observations
Weights recent observations more heavily
Prophet addresses limitations of traditional methods while maintaining interpretability. Here is how each method compares:
| Method | Handles Trend | Handles Seasonality | Handles Holidays | Missing Data | Complexity |
|---|---|---|---|---|---|
| Naïve | No | No | No | Poor | Very Low |
| Moving Average | Lags behind | No | No | Poor | Low |
| Exponential Smoothing | Basic | No* | No | Moderate | Low |
| Holt-Winters | Yes | Yes | No | Moderate | Medium |
| Prophet | Yes (flexible) | Yes (multiple) | Yes | Excellent | Medium |
*Simple Exponential Smoothing does not handle seasonality; Holt-Winters (Triple Exponential Smoothing) does.
Each forecasting method has scenarios where it excels. Understanding when to use each method is crucial for effective forecasting.
Prophet is not always better. For simple data without holidays or multiple seasonalities, simpler methods like Holt-Winters may perform equally well with less computational cost. Always start simple and add complexity only when needed.
Prophet is a forecasting procedure developed by Facebook's (now Meta's) Core Data Science team. It is designed specifically for business time series that exhibit strong seasonal patterns.
Prophet uses an additive model where non-linear trends are combined with:
Prophet is open source and available for download on CRAN (for R) and PyPI (for Python), as well as through Exploratory.io.
Prophet uses a decomposable time series model with three main components. The model is expressed as:
| Component | Description | Example |
|---|---|---|
| g(t) - Trend | Piecewise linear or logistic growth curve for modelling non-periodic changes | Long-term growth in user adoption |
| s(t) - Seasonality | Periodic changes (weekly, yearly patterns) | Higher sales during December |
| h(t) - Holidays | Effects of holidays with irregular schedules (user-provided) | Easter, Black Friday sales spikes |
| εt - Error | Accounts for unusual changes not captured by the model | Random fluctuations, unexpected events |
The following chart demonstrates how Prophet decomposes a time series into its components. The final forecast is the sum of trend, seasonality, and holiday effects.
By separating the time series into interpretable components, Prophet makes it easier to understand what is driving changes in your data. This is particularly valuable for business stakeholders who need to explain forecasts.
Not all forecasting problems benefit equally from Prophet. The tool is specifically optimised for business forecasting scenarios with the following characteristics:
Prophet was developed to be accessible to analysts who may not have deep statistical expertise. The key design principles include:
Users can specify irregular holidays like Easter, Ramadan, or major sporting events that don't fall on fixed dates but significantly impact the time series.
By using a flexible regression approach rather than traditional time series models, Prophet provides greater modelling flexibility, easier model fitting, and more graceful handling of missing data and outliers.
Let us examine a real-world application of Prophet using bike-sharing data from Chicago (Divvy). This case study demonstrates how Prophet handles seasonal patterns and external factors.
The dataset contains daily bike ride counts along with weather information (temperature and rainfall). The time series exhibits:
Source: Greg Rafferty, "Forecasting in Python with Facebook Prophet"
The Chicago bike share data reveals a strong correlation between temperature and ridership. Prophet can incorporate such external regressors to improve forecast accuracy.
Prophet allows you to add additional variables (like temperature or marketing spend) that influence your target variable. This makes forecasts more accurate when external factors have predictable effects.
When Prophet generates a forecast, it produces several key outputs that help you understand and communicate the results:
Prophet automatically generates a components plot that breaks down the forecast into its constituent parts. The sum of these components equals the final forecast.
The weekly pattern shows ridership is relatively constant Monday through Friday, with a steep decline on weekends. This supports the hypothesis that most riders are weekday commuters rather than recreational users.
Setting a capacity threshold (e.g., 120% of historical peak) helps businesses prepare for high-demand periods and avoid stockouts or service failures.
Extrapolation is the process of extending patterns observed in historical data into the future. It is the fundamental mechanism behind most forecasting methods, including Prophet.
The forecasting model identifies patterns (trends, seasonality, cycles) in your historical data and projects these patterns forward. The assumption is that future behaviour will resemble past behaviour.
Complete the following Python notebooks to practice Prophet implementation:
These activities demonstrate how Prophet handles extrapolation, computes error metrics, and helps you understand how uncertainty grows as you forecast further into the future.
To evaluate the quality of forecasting models, we use standardised accuracy measures that quantify how close our predictions are to the actual observed values.
Smaller error values indicate better predictions.
We will examine three primary metrics: RMSE, MAPE, and MSE. Each has different strengths and is suited to different situations.
RMSE (also called Root Mean Square Deviation or RMSD) measures the average magnitude of forecast errors, giving higher weight to larger errors.
MAPE expresses forecast accuracy as a percentage, making it easy to interpret and compare across different scales.
| MAPE | Accuracy |
|---|---|
| < 10% | Highly accurate |
| 10-20% | Good |
| 20-50% | Reasonable |
| > 50% | Poor |
MSE (also called Mean Square Deviation or MSD) is the average of squared differences between predicted and actual values. It forms the basis for many statistical calculations.
Note that RMSE is simply the square root of MSE: RMSE = √MSE
RMSE is generally preferred for reporting because it is in the same units as your data. If your sales are in dollars, RMSE will be in dollars, making it easier to understand the practical impact of forecast errors.
When comparing different types of forecasting models, we use information criteria to measure model quality while penalising complexity.
AIC balances goodness of fit against model complexity. Lower AIC values indicate a better model.
BIC applies a stronger penalty for model complexity than AIC, especially with larger datasets.
Choose the model with the LOWEST AIC or BIC value.
Prophet supports both additive and multiplicative seasonality modes. Choosing the correct mode significantly impacts forecast accuracy.
Pattern: Seasonal swings remain constant regardless of the level
Example: Sales always increase by $10,000 in December
Use when: Seasonal variation is roughly constant over time
Pattern: Seasonal swings grow proportionally with the level
Example: Sales always increase by 15% in December
Use when: Seasonal variation grows with the trend
Look at your data: If the peaks and troughs get larger as the overall level increases, use multiplicative. If they stay roughly the same size, use additive.
You have completed the materials for Prophet for Business Forecasting. Ensure you complete the Python activities and prepare for the upcoming content on ARIMA and SARIMA modelling in Week 7.