Kumo Anomaly
Kumo Anomaly is part of the Kumo-TS library, not SDM. Install the Kumo-Anomaly package (Python 3.12 or later) before running the example.
Kumo Anomaly scores every time step of a multivariate series by how well a diffusion model can reconstruct it from its surroundings, and flags anomalous steps. It needs no labels.
At a Glance
How It Works

- Features are reduced with PCA and scaled, then split into windows.
- Masks hide blocks of time steps. A conditional diffusion model reconstructs each hidden block from the visible context, sampling several times.
- The mean absolute reconstruction error gives the
MAEscore per time step. - An adaptive threshold turns scores into the
Anomalyflag.
Example
Run this script with uv run from the Kumo-TS/Kumo-Anomaly directory.
The first run downloads the weights into the working directory.
All ten injected steps (300 to 309) are flagged, plus five false alarms; nine of the ten highest scores fall on the injected steps.
The run took about 100 seconds on an Apple laptop GPU and repeats exactly with set_seed.
Read the Output
Generate a Report
Pass sdk_config=ADDiffusionConfig(report_path="report.pdf", timestamp_column="timestamp", ground_truth_column="GT") to write a PDF of signals, flags, and scores.
Timestamp and label columns named there are kept in the output but excluded from the model’s features.
Tune Compute and Reproducibility
nsample(default 15) sets the diffusion samples per window. Lower runs faster with noisier scores.- Call
sdk.inference_ad.set_seed(...)before each call for reproducible results.
Inputs and Limits
- Numeric columns only. Other columns raise
The following columns contain non-numeric values: [...]; drop them or declare them inADDiffusionConfig. - At least as many rows as the model’s PCA dimension.
- Weight files go to
model_pathandmodel_config_path, which default to the working directory.
For model size and training details, see the Hugging Face model card.
Fine-Tuning
Fine-tune on normal windows from your own CSV with examples/finetune_example.py.