The forecasting engine analyzes historical time series data and automatically selects the most appropriate modeling approach for each series.
This process is fully automated and runs in the background during forecasting, requiring no manual configuration or model selection.
The engine uses a hybrid modeling strategy that combines:
Global machine learning models, which learn patterns across all series
Series-level statistical models, which capture stable and recurring demand patterns.
How does forecasting work?
Each forecast follows a standardized sequence of steps:
Time grid creation. The system fills in missing dates to create a complete and evenly spaced timeline across all time series. This ensures consistency in model training and prediction.
For more information, see Preparing data for forecasting.
Feature engineering. Calendar-, lag-, and rolling-based features are automatically generated from the data.
Intelligent routing. Each time series is analyzed and classified based on its demand pattern
Model assignment and prediction. The system selects and applies the most suitable model for each series and generates the forecast.
Feature engineering
During training, the engine automatically generates features to help models detect patterns and relationships in the data. These include:
Calendar features. Such as day of week, month, holidays, and seasonal indicators
Lag features. Previous values of the target variable (for example, 1, 7, or 14 periods earlier)
Rolling features. Aggregated statistics such as moving averages and measures of variability.
All features are computed at the individual series level, allowing each time series to learn from its own historical behavior.
Intelligent routing
Before model training, the engine evaluates the historical pattern of each time series using the Median Data Interval (MDI) to determine its demand pattern.
What is the MDI?
MDI measures how frequently demand occurs within a time series. Specifically, it estimates the typical spacing between non-zero observations relative to the expected time frequency.
Low MDI → Demand occurs regularly
High MDI → Demand is sparse or intermittent
In practical terms, MDI indicates how often demand appears over time.
Classification rules
Each time series is classified based on its MDI value:
MDI ≤ 0.5 → Stable demand
Demand occurs regularly with consistent patternsMDI > 0.5 → Intermittent demand
Demand occurs irregularly, with gaps between events
This classification determines which modeling approach is used for each series.
Modeling strategy
The engine applies different models depending on the demand classification.
LightGBM (intermittent demand)
For intermittent series, the engine uses a single global LightGBM model:
Trained across the entire file
Learns patterns that generalize across all series
Handles sparse and irregular demand effectively
Uses engineered features such as calendar, lag, and rolling statistics.
Prophet (stable demand)
For stable series, the engine trains individual Prophet models to capture series-specific behavior.
A series qualifies for Prophet only if:
It is classified as stable (MDI ≤ 0.5)
It contains at least 12 observations
Prophet models:
Are trained separately for each series
Use engineered features such as calendar, lag, and rolling statistics
Automatically detect trend and seasonality
Select the appropriate growth type (linear or flat) based on statistical evaluation.
Summary
The forecasting engine combines:
Automated data preparation
Pattern-based classification using MDI
Hybrid modeling with LightGBM and Prophet
Automatic model selection based on demand characteristics
This approach enables accurate and scalable forecasting across both stable and intermittent demand patterns, without requiring user intervention.