# PyOD

> A Python library for anomaly detection across tabular, time series, graph, text, image, and audio data with 60+ detectors and agentic workflow support.

PyOD is an open-source Python library for anomaly (outlier) detection, established in 2017 by Yue Zhao and maintained as the longest-running library of its kind. Version 3 extends the classic `fit`/`predict` API with lifecycle orchestration via `ADEngine` and an agentic workflow that lets AI agents drive detection through natural language. The project is published under the BSD 2-Clause license and is available via PyPI and conda-forge.

## What It Is

PyOD is a comprehensive toolkit for identifying anomalous data points across multiple modalities. It provides a unified scikit-learn-style API (`fit`, `predict`, `decision_function`, `predict_proba`) over 61 detectors spanning tabular, time series, graph, text, image, and audio data. The library is benchmark-backed, with algorithm rankings drawn from ADBench (tabular), TSB-AD (time series, NeurIPS 2024), BOND (graph, NeurIPS 2022), and NLP-ADBench (text).

## Three-Layer Architecture

PyOD 3 organizes usage into three layers:

- **Layer 1 – Classic API**: Direct instantiation of any detector (e.g., `IForest`, `LOF`, `ECOD`) with `fit`/`predict`. Suitable when the user already knows which algorithm to apply.
- **Layer 2 – ADEngine**: Lifecycle orchestration that automatically profiles data, selects and compares detectors, and produces an assessment report in a single call.
- **Layer 3 – Agentic Investigation**: The `od-expert` skill auto-activates in Claude Code, Codex, and MCP-compatible agents, enabling plain-English anomaly detection conversations without requiring outlier detection expertise.

## Detector Coverage

The library implements algorithms across multiple families:

- **Tabular**: Probabilistic (ECOD, COPOD, KDE, GMM), linear (PCA, KPCA, OCSVM), proximity-based (LOF, kNN, HBOS, HDBSCAN), ensemble (IForest, LSCP, SUOD, XGBOD), and neural network (AutoEncoder, VAE, DeepSVDD, AnoGAN, DevNet) methods — over 40 algorithms total.
- **Time Series**: MatrixProfile, SpectralResidual, KShape, LSTMAD, AnomalyTransformer, SAND, and a windowed bridge (`TimeSeriesOD`) that applies any tabular detector to sliding windows.
- **Graph**: DOMINANT, CoLA, CONAD, AnomalyDAE, GUIDE, Radar, ANOMALOUS, SCAN — all transductive, using PyTorch Geometric `Data` objects.
- **Text & Image**: `EmbeddingOD` wraps foundation model encoders (SentenceTransformer, OpenAI, HuggingFace) and applies any classical detector to the resulting embeddings.
- **Audio**: `EmbeddingOD.for_audio()` extracts 74-dimensional handcrafted acoustic features (MFCC, chroma, spectral); `AudioAE` provides a log-mel reconstruction autoencoder baseline.

## Agentic and MCP Integration

PyOD 3 introduces three activation paths beyond the pure-Python API. Running `pyod install skill` installs the `od-expert` skill globally for Claude Code and Claude Desktop. Running `pip install pyod[mcp]` followed by `pyod mcp serve` starts an MCP server compatible with any MCP-capable LLM. The `pyod info` command detects which agent stack is present and recommends the correct install command. This makes PyOD one of the first anomaly detection libraries to expose a native MCP server interface.

## Update: PyOD v3.6.1

The latest release is v3.6.1, published on June 17, 2026. The v3 series introduced `ADEngine` for lifecycle orchestration and the `od-expert` agentic skill, while keeping the classic API fully backward-compatible. The library reports over 46 million downloads (per the project's own documentation citing pepy.tech) and has accumulated nearly 10,000 GitHub stars. A companion paper, "PyOD 2: A Python Library for Outlier Detection with LLM-powered Model Selection," was published in the Companion Proceedings of the ACM Web Conference 2025, and the original PyOD paper appeared in the Journal of Machine Learning Research (JMLR) in 2019.

## Features
- 61+ anomaly detection algorithms across tabular, time series, graph, text, image, and audio data
- Unified scikit-learn-style API (fit, predict, decision_function, predict_proba)
- ADEngine lifecycle orchestration for automatic detector selection and comparison
- Agentic od-expert skill for Claude Code, Codex, and MCP-compatible agents
- MCP server support via pyod[mcp] extra
- Benchmark-backed algorithm routing (ADBench, TSB-AD, BOND, NLP-ADBench)
- SUOD acceleration for large-scale parallel training
- Numba JIT per-model speedups
- Foundation model embedding support (SentenceTransformer, OpenAI, HuggingFace)
- Audio anomaly detection with MFCC/chroma/spectral features and log-mel autoencoder
- Graph anomaly detection via PyTorch Geometric
- Model persistence (save and load)
- Thresholding methods for converting scores to binary labels
- Synthesized data generation utilities
- ROC-AUC and Precision@n evaluation utilities

## Integrations
Claude Code, Claude Desktop, Codex, MCP-compatible LLMs, PyTorch Geometric, sentence-transformers, OpenAI Embeddings API, HuggingFace Transformers, scikit-learn, NumPy, Pandas, PyPI, conda-forge

## Platforms
WINDOWS, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
3.6.1

## Links
- Website: http://pyod.readthedocs.io
- Documentation: https://pyod.readthedocs.io/en/latest/
- Repository: https://github.com/yzhao062/pyod
- EveryDev.ai: https://www.everydev.ai/tools/pyod
