How-to guides

Choose a guide for the task you need to complete. These guides assume familiarity with the score-then-learn loop in Getting started. For background, see Concepts. For parameters and method signatures, see API reference.

Quick start

Score a stream point by point, measure AUROC, and raise alerts.

Stream your own data

Stream CSV files, DataFrames, sensor values, messages and benchmark datasets.

Dataset inventory

Compare and choose a dataset, and list each pysad.utils.Data loader with its source, license, checksum and label format.

Choose a detector

Find candidate detectors for your data and compare them.

Turn scores into alerts

Calibrate scores, choose a threshold and keep anomalies out of the model.

Calibrate forecast residuals

Normalize forecast residuals and calibrate them with ConformalTSFMCalibrator.

Evaluate a detector

Choose a metric, follow performance over time and report stable results.

Track running statistics

Choose a running statistic, bound its memory and window it over recent values.

Troubleshoot streaming edge cases

Diagnose installation problems and odd scores: cold start, constant streams, NaN or infinite values.

Build a pipeline

Add preprocessing, projections, postprocessing and ensembles.

Detect drift and keep learning

Reset a detector on drift and chain stages into one pipeline.

Detect anomalies in seasonal series

Find anomalies in metrics with a daily or weekly cycle.

Run a PyOD model on a stream

Run a PyOD batch detector on a stream.

Run a detector in production

Start from historical data, save the state, run one detector per source and control the time per point.

Serve detectors in production

Score Polars batches and PyFlink keyed streams, consume from Kafka or Redpanda, expose FastAPI endpoints, and checkpoint state to disk or Redis.

Run PySAD in streaming engines and ML libraries

Run PySAD detectors inside Bytewax, River, CapyMOA, scikit-learn, and scikit-multiflow without adding core dependencies.

View the live dashboard

Open and customize the pysad-live web or terminal dashboard to watch streaming scores and alerts as points arrive.

Run pysad-live with authentication and multiple tenants

Bind pysad-live to localhost, add a reverse proxy with authentication, and run one isolated dashboard per tenant.

Write your own detector

Implement the model interface for a published streaming method and add it to PySAD.

MCP Server for PySAD

Run, monitor, and harden the PySAD MCP server to expose detectors and drift meters to AI assistants.

Configure PySAD

Configure pysad-live, pysad.mcp, and the optional PyO3 kernels in one place.

Example Gallery

Complete scripts that run end to end.

Migration guides

Migrate from Azure AI Anomaly Detector and Metrics Advisor

Replace retired Azure AI Anomaly Detector and Metrics Advisor in Python.

Migrate from AWS Lookout for Equipment and Kinesis RCF

Replace AWS Lookout for Equipment and Kinesis RANDOM_CUT_FOREST with PySAD.

Migrate from unit8co Darts to PySAD

Move from unit8co Darts whole-series forecasting scores to PySAD streaming detection.

Migrate from Salesforce Merlion

Migrate anomaly detection pipelines from archived Salesforce Merlion.

Migrate from Alibi Detect (BSL 1.1) to PySAD (BSD 3-Clause)

Move from BSL 1.1 Alibi Detect to permissive BSD 3-Clause PySAD.

Migrate from StatsForecast and Nixtla to PySAD

Replace StatsForecast and Nixtla batch forecasts with PySAD streaming pipelines.

Migrate from ADTK to PySAD

Map ADTK batch rule-based and statistical detection to PySAD streaming detection.

Migrate from PyOD to PySAD

Move from PyOD batch detection to PySAD prequential streaming detection.

Migrate from River to PySAD

Translate River streaming anomaly detection to PySAD streaming detection.