Run Kumo Forecast
Kumo Forecast is part of the Kumo-TS library, not SDM. Install the Kumo-Forecast package before running the example.
Use perform_forecasting to predict future values of a series from its history.
For what the model is and how it works, see Kumo Forecast.
Shape Your Data
timestamp_column: evenly spaced timestamps. The forecast continues at the same frequency.target_column: the series to forecast.- Other numeric columns are used as covariates automatically.
- Provide at least
seq_lenrows (default 512). - Cross-channel attention between the target and covariates is on by default (
use_cross_channel=True).
Example
Run this script with uv run from the Kumo-TS/Kumo-Forecast directory.
The first run downloads the Kumo checkpoint into the working directory and the MOMENT backbone into the Hugging Face cache.
The output has one row per forecast hour, continuing the input timestamps. Forecast values can differ slightly across devices. With an empty cache, the first run downloads the Kumo checkpoint (about 1.4 GB) and the MOMENT backbone (also about 1.4 GB).
Kumo-Forecast loads data in worker processes.
On macOS and Windows, those workers import your script again, so keep the model call under if __name__ == "__main__":.
Without it, DARR fails with DataLoader worker ... exited unexpectedly.
Retrieval from History (DARR)
Pass an archive of past data as context_df to blend the continuations of similar past windows into the forecast.
alpha weights the direct forecast (alpha * direct + (1 - alpha) * retrieved; default 0.01), k sets the number of neighbors (default 64), and temperature sets how sharply they are weighted (default 0.05).
Archive windows are indexed every context_stride rows, which defaults to the 72-step model horizon.
For hourly data with a daily cycle, every window then ends at the same hour of day, and retrieved continuations are out of phase with the forecast.
Set context_stride=1, or a value that is not a multiple of your cycle length.
In a synthetic hourly test, this cut the retrieval-only error from 23.87 to 9.52 MAE.
Explain a Forecast
Kumo Forecast shows how much weight the model assigns to recent history at each forecast step. When the input includes multiple series, it also reports their relative contributions.
To see which lookback lengths receive the most weight for each forecast hour in the example above, run the load series with interpretability=True.
When matplotlib is installed, this code generates a PDF report with a lag attribution heatmap and saves it to interpretability_output/load_forecast/explanation_report.pdf.
See the interpretability reference for the JSON and CSV outputs.
Inputs and Limits
- At least
seq_lenrows; fewer raisesDataFrame has N rows but seq_len requires at least 512 rows. - Missing target values are filled with zeros.
- For DARR,
context_dfneeds the same timestamp and target columns, at least one shared covariate, and at leastseq_len + max(72, forecast_horizon)rows. Setcontext_strideto match your seasonality (see above). - DARR does not always beat the direct forecast. Compare both on a held-out window of your own data.
- Weight files are written to the paths in
standardizer_pklandckpt, which default to the working directory.
Fine-Tuning
Fine-tune on your own CSV with examples/finetune_example.py.