Prophet
Facebook's forecasting tool designed for business time series with strong seasonal effects
Prophet is a forecasting tool developed by Facebook designed to handle time series data with strong seasonal effects and several seasons of historical data. It excels at automatically detecting holidays, trends, and multiple seasonality patterns with minimal manual tuning.
When to Use Prophet
Prophet is best suited for:
- Business metrics with daily observations spanning months or years
- Time series with strong seasonal patterns (daily, weekly, yearly)
- Data with multiple seasonality cycles (e.g., day-of-week + time-of-year)
- Series with holiday effects and special events
- When you have external regressors (additional features)
- Scenarios where you need robust handling of missing data and outliers
Strengths
- Automatic detection of yearly, weekly, and daily seasonality
- Handles missing data and outliers gracefully
- Intuitive parameters that map to business domain knowledge
- Built-in support for holidays and special events
- Provides uncertainty intervals with seasonality
- Works well with irregular time series (missing timestamps)
- Accepts additional regressors (exogenous variables)
- Fast fitting, even with large datasets
- Produces interpretable components (trend, seasonality, holidays)
Weaknesses
- Requires sufficient historical data (ideally 1+ years for yearly seasonality)
- May overfit on short time series (< 2 seasonal cycles)
- Not ideal for high-frequency data (sub-hourly) without aggregation
- Additive/multiplicative choice requires domain knowledge
- Can produce unrealistic extrapolations if trend parameters are misconfigured
- Limited to univariate forecasting (one target at a time)
Parameters
Common Time Series Parameters
All time series models share these parameters:
- Timestamp Column (required): Column containing dates/times
- Target Column (required): Numeric value to forecast
- Extra Regressors (optional): Additional feature columns (e.g., 'temperature', 'discount')
- Frequency (optional): Time spacing (D, H, W, M). Auto-inferred if not specified
- Forecast Steps (required, default=1): How many periods to predict
- Aggregation (default='mean'): Method for duplicate timestamps
- Fill Method (default='interpolate'): How to handle missing values
- Smoothing (default=false): Whether to apply smoothing
- Add Lags (optional): List of lag periods to use as features (e.g., [1, 7] for yesterday and last week)
- Add Rolling Mean (optional): Rolling mean window sizes (e.g., [7, 14] for 7-day and 14-day averages)
Prophet-Specific Parameters
Changepoint Prior Scale
- Type: Float
- Default: 0.05
- Min: 0.001
- Description: Controls trend flexibility. Higher values make the trend more flexible to fit sudden changes
- Tuning: Increase if trend changes are underfit; decrease if trend is overfitting noise
- Example: 0.5 for volatile trends, 0.01 for smooth trends
Seasonality Prior Scale
- Type: Float
- Default: 10.0
- Min: 0.01
- Description: Controls the flexibility of seasonality components. Higher values allow more variation in seasonal patterns
- Tuning: Increase for strong seasonal variation; decrease for subtle seasonality
- Example: 15.0 for highly seasonal data, 1.0 for weak seasonality
Seasonality Mode
- Type: String
- Default: 'additive'
- Options: ['additive', 'multiplicative']
- Description: How seasonality combines with trend
- Additive: Seasonal effect is a constant addition (e.g., +10 units every December)
- Multiplicative: Seasonal effect is proportional to trend (e.g., +10% every December)
- Guidance: Use multiplicative when seasonal variation grows with the trend level
Growth
- Type: String
- Default: 'linear'
- Options: ['linear', 'logistic', 'flat']
- Description: The type of growth trend
- Linear: Unbounded growth/decline
- Logistic: Growth with saturation (requires cap)
- Flat: No trend
- Example: Use 'logistic' for market saturation scenarios
N Changepoints
- Type: Integer
- Default: 25
- Min: 0
- Description: Number of potential changepoints where trend rate can change. More changepoints = more flexible trend
- Guidance: Increase for very long or volatile histories (100+ for multi-year data)
Changepoint Range
- Type: Float
- Default: 0.8
- Min: 0.0
- Max: 1.0
- Description: Proportion of history in which trend changepoints will be estimated. 0.8 means changepoints only in first 80%
- Guidance: Prevents overfitting to recent noise by excluding the tail from changepoint detection
Uncertainty Interval
- Type: Float
- Default: 0.8
- Min: 0.0
- Max: 1.0
- Description: Width of the prediction interval (e.g., 0.95 for 95% confidence)
- Example: 0.95 for wide intervals, 0.5 for narrow intervals
Yearly Seasonality
- Type: String
- Default: 'auto'
- Options: ['auto', 'true', 'false']
- Description: Whether to model yearly seasonal patterns
- auto: Enabled if data spans 2+ years
- true: Force yearly seasonality
- false: Disable yearly seasonality
Weekly Seasonality
- Type: String
- Default: 'auto'
- Options: ['auto', 'true', 'false']
- Description: Whether to model weekly seasonal patterns
- auto: Enabled if data spans 2+ weeks
- true: Force weekly seasonality
- false: Disable weekly seasonality
Daily Seasonality
- Type: String
- Default: 'auto'
- Options: ['auto', 'true', 'false']
- Description: Whether to model daily seasonal patterns (intraday)
- auto: Enabled if data has sub-daily frequency
- true: Force daily seasonality
- false: Disable daily seasonality
Hyperparameter Tuning Parameters
- Tune Hyperparameters (default=false): Enable automatic optimization
- Tuning Method (default='grid'): grid or random search
- Number of Trials (default=20): For random search
- CV Folds (default=3): Time series cross-validation folds
- Scoring Metric (default='rmse'): rmse, mae, or mape
Configuration Tips
Quick Start Configuration
For most business time series, start with:
- Seasonality Mode: 'additive'
- Growth: 'linear'
- Yearly Seasonality: 'auto'
- Weekly Seasonality: 'auto'
- Daily Seasonality: 'auto'Handling Different Patterns
Strong Trend with Seasonality:
- Set
changepoint_prior_scale=0.1for flexible trend - Use
seasonality_mode='multiplicative'if variation grows with trend
Stable with Strong Seasonality:
- Keep default
changepoint_prior_scale=0.05 - Increase
seasonality_prior_scale=15.0
Volatile/Noisy Data:
- Decrease
changepoint_prior_scale=0.01 - Decrease
seasonality_prior_scale=5.0
Adding External Features
Use Extra Regressors for:
- Marketing spend
- Promotions/discounts
- Weather data
- Economic indicators
Prophet will automatically model their effects on the target.
Handling Growth Saturation
If your metric has a ceiling (e.g., market size):
- Set
growth='logistic' - You'll need to specify capacity in your data
Seasonal Period Selection
- Daily frequency: Enable weekly and yearly seasonality
- Hourly frequency: Enable daily, weekly, and yearly seasonality
- Monthly frequency: Only yearly seasonality makes sense
Common Issues and Solutions
Issue: Trend Overshoots Unrealistically
Solution:
- Decrease
changepoint_prior_scaleto 0.01 or 0.001 - Use
growth='flat'if no trend expected - Consider
growth='logistic'with a cap for bounded growth
Issue: Missing Seasonal Patterns
Solution:
- Ensure you have 2+ complete seasonal cycles in training data
- Force seasonality: set
yearly_seasonality='true'orweekly_seasonality='true' - Increase
seasonality_prior_scaleto 15.0 or 20.0
Issue: Overfitting to Noise
Solution:
- Decrease
changepoint_prior_scaleto 0.01 - Decrease
n_changepointsto 10-15 - Set
changepoint_range=0.7to exclude recent volatile data
Issue: Poor Performance on Short History
Solution:
- Prophet needs sufficient data (at least 2 seasonal cycles)
- For < 6 months of data, consider simpler models like ARIMA or Exponential Smoothing
- Disable seasonality that lacks sufficient history
Issue: Forecast Ignores Recent Trend Change
Solution:
- Increase
changepoint_prior_scaleto 0.1 or 0.5 - Increase
changepoint_rangeto 0.9 to allow recent changepoints - Add relevant external regressors that explain the change
Issue: Multiplicative vs Additive Seasonality
Solution:
- Use multiplicative if seasonal swings grow with the overall level (e.g., retail sales)
- Use additive if seasonal swings are roughly constant (e.g., temperature)
- Compare both modes using cross-validation metrics
Issue: Holidays Not Captured
Solution:
- Prophet has built-in holidays for many countries
- Ensure your timestamp column is in proper date format
- Add custom holidays using Prophet's API if needed
Example Use Cases
- Daily website traffic: Weekly + yearly seasonality, captures day-of-week and holiday effects
- Hourly energy consumption: Daily + weekly seasonality, handles intraday and weekly patterns
- Monthly retail sales: Yearly seasonality with promotional regressors
- App downloads with marketing: Trend + weekly seasonality + marketing spend as regressor
- Restaurant revenue: Weekly seasonality (weekend peaks) + holiday effects + weather regressors