Once your data is clean, you can begin training and deploying forecasting models using ML.FORECAST. The process involves creating a model object and then calling it to generate predictions.
Single-Series vs. Multi-Series Forecast Models
A single-series model predicts one outcome based on one timeline. Enterprise businesses achieve better visibility by forecasting multiple outcomes simultaneously. You likely need to forecast thousands of SKUs across hundreds of locations.
Snowflake handles this seamlessly through multi-series forecasting. You can group your data logically by passing a series column.
CREATE OR REPLACE SNOWFLAKE.ML.FORECAST demand_model (
INPUT_DATA => SYSTEM$REFERENCE('VIEW', 'historical_sales_prepared'),
TIMESTAMP_COLNAME => 'sales_date',
TARGET_COLNAME => 'adjusted_sales_quantity',
SERIES_COLNAME => 'sku_location_id'
);
This single SQL command trains a tailored model for every unique SKU and location combination. It scales effortlessly across massive datasets.
Including Holidays, Promotions, and External Variables
Enriching historical data with external variables produces highly accurate predictions. Demand fluctuates based on external factors. Adding prediction intervals and custom holiday lists to improve accuracy is an essential step.
You can feed exogenous variables into your Snowflake forecasting model. These variables might include weather data, competitor pricing, or promotional flags. You simply include these columns in your training view.
CREATE OR REPLACE SNOWFLAKE.ML.FORECAST demand_model_with_holidays (
INPUT_DATA => SYSTEM$REFERENCE('VIEW', 'historical_sales_with_features'),
TIMESTAMP_COLNAME => 'sales_date',
TARGET_COLNAME => 'adjusted_sales_quantity',
SERIES_COLNAME => 'sku_location_id'
);
To generate the forecast, you must also provide an inference dataset. This dataset must contain the future dates and the known future values of your external variables. For example, you already know the dates of future holidays and planned promotions.
You can learn more about configuring these features in the Snowflake time-series forecasting guide for advanced setups.
Prediction Intervals and Uncertainty Quantification
Comprehensive prediction intervals provide the depth needed for effective supply chain planning. Knowing that you will sell 100 units is helpful. Knowing that you will sell between 80 and 120 units with high confidence is actionable.
You can configure the prediction_interval during the forecast generation. This quantifies uncertainty and enables upside and downside scenario planning.
CALL demand_model_with_holidays!FORECAST(
INPUT_DATA => SYSTEM$REFERENCE('VIEW', 'future_features_view'),
TIMESTAMP_COLNAME => 'future_date',
SERIES_COLNAME => 'sku_location_id',
CONFIG_OBJECT => {'prediction_interval': 0.95}
);
A 95% prediction interval means you can be highly confident that actual demand will fall within the upper and lower bounds. Supply chain analysts use the upper bound to set safety stock levels. Financial analysts use the lower bound for conservative revenue projections.