Metadata-Version: 2.4
Name: aberrant
Version: 0.5.0
Summary: Online Anomaly Detection Models
Project-URL: Homepage, https://github.com/OliverHennhoefer/aberrant
Project-URL: Bugs, https://github.com/OliverHennhoefer/aberrant/issues
Project-URL: Documentation, https://oliverhennhoefer.github.io/aberrant
Project-URL: Changelog, https://github.com/OliverHennhoefer/aberrant/blob/main/CHANGELOG.md
Author: Pascal Heinzelmann, Marius Hoell, Marco Catoir
Author-email: Oliver Hennhoefer <oliver.hennhoefer@mail.de>
Maintainer-email: Oliver Hennhoefer <oliver.hennhoefer@mail.de>
License: MIT License
        
        Copyright (c) 2025 Oliver Hennhöfer
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.10
Requires-Dist: faiss-cpu>=1.10.0
Requires-Dist: numpy>=2.2.3
Requires-Dist: scipy>=1.15.2
Requires-Dist: tqdm>=4.67.1
Provides-Extra: all
Requires-Dist: hypothesis<7.0.0,>=6.0.0; extra == 'all'
Requires-Dist: mkdocs; extra == 'all'
Requires-Dist: mkdocs-material[imaging]; extra == 'all'
Requires-Dist: mkdocstrings[python]; extra == 'all'
Requires-Dist: mypy<2.0.0,>=1.13.0; extra == 'all'
Requires-Dist: pre-commit<5.0.0,>=4.0.0; extra == 'all'
Requires-Dist: pyarrow<24.0.0,>=18.0.0; extra == 'all'
Requires-Dist: pytest-benchmark<6.0.0,>=5.0.0; extra == 'all'
Requires-Dist: pytest-cov<8.0.0,>=6.0.0; extra == 'all'
Requires-Dist: pytest<10.0.0,>=8.0.0; extra == 'all'
Requires-Dist: river<1.0.0,>=0.22.0; extra == 'all'
Requires-Dist: ruff<1.0.0,>=0.8.0; extra == 'all'
Requires-Dist: scikit-learn<2.0.0,>=1.6.1; extra == 'all'
Requires-Dist: torch<3.0.0,>=2.6.0; extra == 'all'
Provides-Extra: benchmark
Requires-Dist: pytest-benchmark<6.0.0,>=5.0.0; extra == 'benchmark'
Requires-Dist: river<1.0.0,>=0.22.0; extra == 'benchmark'
Provides-Extra: dev
Requires-Dist: hypothesis<7.0.0,>=6.0.0; extra == 'dev'
Requires-Dist: mypy<2.0.0,>=1.13.0; extra == 'dev'
Requires-Dist: pre-commit<5.0.0,>=4.0.0; extra == 'dev'
Requires-Dist: pytest-cov<8.0.0,>=6.0.0; extra == 'dev'
Requires-Dist: pytest<10.0.0,>=8.0.0; extra == 'dev'
Requires-Dist: ruff<1.0.0,>=0.8.0; extra == 'dev'
Requires-Dist: scikit-learn<2.0.0,>=1.6.1; extra == 'dev'
Requires-Dist: torch<3.0.0,>=2.6.0; extra == 'dev'
Provides-Extra: dl
Requires-Dist: torch<3.0.0,>=2.6.0; extra == 'dl'
Provides-Extra: docs
Requires-Dist: mkdocs; extra == 'docs'
Requires-Dist: mkdocs-material[imaging]; extra == 'docs'
Requires-Dist: mkdocstrings[python]; extra == 'docs'
Provides-Extra: eval
Requires-Dist: scikit-learn<2.0.0,>=1.6.1; extra == 'eval'
Provides-Extra: parquet
Requires-Dist: pyarrow<24.0.0,>=18.0.0; extra == 'parquet'
Description-Content-Type: text/markdown

# 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

```bash
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

```python
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

```bash
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`).
