Forecasting
Kumo Relational forecasting repeats a temporal target across consecutive future windows. Use forecasting when you need a sequence of predictions for one entity rather than a single aggregate over the entire horizon.
In this client workflow, sdm-client asks one regression call per forecast step and assembles the results. On your side, materialize() and predict() still handle it in one call each. This also works with deployments that natively serve only classification and regression.
Minimal Forecast
The following example requests a minimal forecast for one entity:
This query requests eight consecutive predictions for seven-day windows for account 42, as eight calls.
Requirements and Limits
Review the following requirements and limits before you run a forecast:
- Forecast predictions for one entity per request.
- Use a temporal aggregation with an explicit window and unit.
- Provide enough ordered history before the anchor time to represent the pattern.
- Ensure that the target and entity have a valid relationship in the schema.
- A forecast cannot be pinned with
fit(): each step needs the context that supplies its own labels, while a session pins one context.
Supported target forms depend on the deployed NIM release. Start with SUM, COUNT, or COUNT_DISTINCT.
Window Semantics
Consider the following target:
The first forecast row covers the first seven-day window after the anchor time. The second row covers the next seven-day window, and so on. The start boundary is excluded, and the end boundary is included: 0, 7, days covers (anchor, anchor + 7 days].
Anchor Time and Lagged Targets
The following example sets an anchor time, lagged targets, and the prediction timestamp feature:
The example uses the following options:
anchor_timesets the beginning of the forecast.lag_timestepssupplies previous target windows as additional context.use_prediction_timesupplies the prediction timestamp as a feature.
Evaluate these options with historical backtests because they do not improve results for every dataset.
Narrowing the Context Narrows by Anchor, Not at Random
When num_context_samples narrows a forecast’s gathered context, each step narrows around its own anchor, keeping the newest anchor dates in full rather than thinning the whole span. The random_seed parameter governs which entities are sampled within an anchor, not which anchor dates are kept. Refer to Limits.
Results
The output of result.to_pandas() carries row_index, id, prediction, and forecast_step (a one-based sequence number for the forecast period). A forecast returns one row per timeframe. The following example prints the first rows of the forecast:
Troubleshooting
The following table lists common symptoms and what to check:
Related Topics
For the full set of Kumo Relational prediction types, including forecasting, refer to Prediction Types.