Skip to main content
https://github.com/selimfirat/pysad/raw/master/docs/logo.png

Python Streaming Anomaly Detection (PySAD)

PyPI GitHub release (latest by date) Documentation status Azure Pipelines Build Status Circle CI Coverage Status PyPI - Python Version Supported Platforms License

PySAD is an open-source python framework for anomaly detection on streaming multivariate data.

Documentation

Features

Online Anomaly Detection

PySAD provides methods for online/sequential anomaly detection, i.e. anomaly detection on streaming data, where the model updates itself as a new instance arrives.

Resource-Efficient

Streaming methods efficiently handle the limited memory and processing time requirements of the data streams so that they can be used in near real-time. The methods can only store an instance or a small window of recent instances.

Complete

PySAD contains stream simulators, evaluators, preprocessors, statistic trackers, postprocessors, probability calibrators and more. In addition to streaming models, PySAD also provides integrations for batch anomaly detectors of the PyOD so that they can be used in the streaming setting.

Comprehensive

PySAD serves models that are specifically designed for both univariate and multivariate data. Furthermore, one can experiment via PySAD in supervised, semi-supervised and unsupervised setting.

User Friendly

Users with any experience level can easily use PySAD. One can easily design experiments and combine the tools in the framework. Moreover, the existing methods in PySAD are easy to extend.

Free and Open Source Software (FOSS)

PySAD is distributed under BSD License 2.0 and favors FOSS principles.

Installation

The PySAD framework can be installed via:

pip install -U pysad

Alternatively, you can install the library directly using the source code in Github repository by:

git clone https://github.com/selimfirat/pysad.git
cd pysad
pip install .

Required Dependencies:

  • Python: 3.10+

  • numpy: 2.1.3

  • scikit-learn: 1.5.2

  • scipy: 1.15.3

  • statsmodels: 0.14.4 (for pysad.models.SeasonalESD, pysad.models.SeasonalHybridESD and pysad.transform.preprocessing.ModifiedSTLResidualTransformer)

  • pyod: 3.5.2

  • combo: 0.1.3

Optional Dependencies:

  • rrcf: 0.4.4 (for pysad.models.robust_random_cut_forest.RobustRandomCutForest)

  • PyNomaly: 0.3.5 (for pysad.models.loop.StreamLocalOutlierProbability)

  • mmh3: 2.5.1 (for pysad.models.xstream.xStream)

  • pandas: 2.2.3 (for pysad.utils.pandas_streamer.PandasStreamer)

  • jax: >=0.6.1 (for pysad.models.inqmad.Inqmad; required for NumPy 2.0+ compatibility of this module)

  • jaxlib: >=0.6.1 (for pysad.models.inqmad.Inqmad; required for NumPy 2.0+ compatibility of this module)

Examples

Quick Start

Here’s a simple example showing how to use PySAD for anomaly detection on streaming data:

# Import modules.
from pysad.evaluation import AUROCMetric
from pysad.models import LODA
from pysad.utils import Data


model = LODA()  # Init model
metric = AUROCMetric()  # Init area under receiver-operating- characteristics curve metric
streaming_data = Data().get_iterator("arrhythmia.mat")  # Get data streamer.

for x, y_true in streaming_data:  # Stream data.
    anomaly_score = model.fit_score_partial(x)  # Fit the instance to model and score the instance.

    metric.update(y_true, anomaly_score)  # Update the AUROC metric.

# Output the resulting AUROCMetric.
print(f"Area under ROC metric is {metric.get()}.")

Contributors

Contributors

We thank all our contributors for their valuable input and efforts to make PySAD better!

Versioning

Semantic versioning is used for this project.

License

This project is licensed under the BSD License 2.0.

Citing PySAD

If you use PySAD for a scientific publication, please cite the following paper:

@article{pysad,
  title={PySAD: A Streaming Anomaly Detection Framework in Python},
  author={Yilmaz, Selim F and Kozat, Suleyman S},
  journal={arXiv preprint arXiv:2009.02572},
  year={2020}
}

Release files for pysad 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pysad 0.6.0
File Size Uploaded
pysad-0.6.0.tar.gz 73.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pysad 0.6.0
File Interpreter ABI Platform
pysad-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 150.4 kB

Release files / pysad-0.6.0.tar.gz

Download URL pysad-0.6.0.tar.gz
Size 73.5 kB
Tags Source
SHA-256 checksum
How to use checksums
006f37283f1246e01651f27aa3d3f77cc691952079f949b45f20390e7b91789e
BLAKE2b-256 checksum
How to use checksums
a6625d99c1dd32a863c93b76b44f9e40d8b5d059ae79244a84b53abd7c5fd984
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release files / pysad-0.6.0-py3-none-any.whl

Download URL pysad-0.6.0-py3-none-any.whl
Size 76.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc966eed5b0712a9f13e8f856a1ce3474f8050dd2c43597628199f01b8f2d68e
BLAKE2b-256 checksum
How to use checksums
47d6dcf3e30b2e33bbc1220b61e3ac4a309d3ae27cf35cfd356dff3d2f4b529b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page