Skip to main content

Online Anomaly Detection Models

Project description

ABERRANT

Online anomaly detection for streaming data.

Highlights

  • Streaming-first model APIs: learn_one and score_one
  • Detector families: isolation forests, distance, SVM, statistical
  • Dataset streaming API with caching
  • Composable transforms and pipelines

Install

pip install aberrant

Optional extras:

  • aberrant[eval] for evaluation metrics (scikit-learn)
  • aberrant[dl] for deep models (torch)
  • aberrant[parquet] for legacy parquet streaming (pyarrow)
  • aberrant[dev], aberrant[docs], aberrant[benchmark], aberrant[all]

Quick example

from aberrant.model.iforest import OnlineIsolationForest
from aberrant.stream.dataset import Dataset, load

model = OnlineIsolationForest(window_size=512, num_trees=50)
dataset = load(Dataset.SHUTTLE)

for i, (x, y) in enumerate(dataset.stream()):
    if i < 2000:
        if y == 0:
            model.learn_one(x)
        continue

    score = model.score_one(x)

    if score > 0.8:
        print("anomaly", score, y)

    model.learn_one(x)

Stable public imports

  • aberrant.drift
  • aberrant.model.iforest
  • aberrant.model.distance
  • aberrant.model.svm
  • aberrant.model.stat
  • aberrant.transform.preprocessing
  • aberrant.transform.projection
  • aberrant.stream.dataset

Score conventions

  • ThresholdModel: binary score (0.0 or 1.0)
  • Isolation forest variants: bounded score in [0, 1]
  • Distance/SVM/statistical models: model-specific continuous scores

Optional dependency behavior

  • Deep models are optional (aberrant[dl]).
  • Deep unit tests auto-skip when torch is unavailable.
  • Integration tests require aberrant[eval].

Development

uv sync --extra dev --extra docs
uv run python -m ruff check .
uv run python -m pytest -q

Project docs

  • Docs site config: docs/mkdocs.yml
  • Changelog: CHANGELOG.md
  • Contributing: CONTRIBUTING.md
  • Security policy: SECURITY.md

License

MIT (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aberrant-0.5.0.tar.gz (255.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aberrant-0.5.0-py3-none-any.whl (94.9 kB view details)

Uploaded Python 3

File details

Details for the file aberrant-0.5.0.tar.gz.

File metadata

  • Download URL: aberrant-0.5.0.tar.gz
  • Upload date:
  • Size: 255.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aberrant-0.5.0.tar.gz
Algorithm Hash digest
SHA256 385bd6cdc841e66cd4a4bd6d4ad7a198c661b47118459dd55217026b2f82bc4d
MD5 0870a6fddc184c11cceec0546ad5220a
BLAKE2b-256 e3acc0fa68449eca6bf0d2aa3e2c1e13834cdeaa40efe4291f2fb42447f9d3ab

See more details on using hashes here.

File details

Details for the file aberrant-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: aberrant-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 94.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for aberrant-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e7d5163fa1819c1d865c20c4dcec3421b68b9d8d19bb80bf9586bf3c320e6506
MD5 1578ce360b7717dc8b3008d155f67acc
BLAKE2b-256 1219dda01cbe0439c1d21f4bb275419c4dbd9275233ae1871edc09e197c09567

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page