Pyod
A Python Library for Outlier and Anomaly Detection, Integrating Classical and Deep Learning Techniques
Install / Use
/learn @yzhao062/PyodREADME
Python Outlier Detection (PyOD) V2
Deployment & Documentation & Stats & License
|badge_pypi| |badge_anaconda| |badge_docs| |badge_stars| |badge_forks| |badge_downloads| |badge_testing| |badge_coverage| |badge_maintainability| |badge_license| |badge_benchmark|
.. |badge_pypi| image:: https://img.shields.io/pypi/v/pyod.svg?color=brightgreen :target: https://pypi.org/project/pyod/ :alt: PyPI version
.. |badge_anaconda| image:: https://anaconda.org/conda-forge/pyod/badges/version.svg :target: https://anaconda.org/conda-forge/pyod :alt: Anaconda version
.. |badge_docs| image:: https://readthedocs.org/projects/pyod/badge/?version=latest :target: https://pyod.readthedocs.io/en/latest/?badge=latest :alt: Documentation status
.. |badge_stars| image:: https://img.shields.io/github/stars/yzhao062/pyod.svg :target: https://github.com/yzhao062/pyod/stargazers :alt: GitHub stars
.. |badge_forks| image:: https://img.shields.io/github/forks/yzhao062/pyod.svg?color=blue :target: https://github.com/yzhao062/pyod/network :alt: GitHub forks
.. |badge_downloads| image:: https://pepy.tech/badge/pyod :target: https://pepy.tech/project/pyod :alt: Downloads
.. |badge_testing| image:: https://github.com/yzhao062/pyod/actions/workflows/testing.yml/badge.svg :target: https://github.com/yzhao062/pyod/actions/workflows/testing.yml :alt: Testing
.. |badge_coverage| image:: https://coveralls.io/repos/github/yzhao062/pyod/badge.svg :target: https://coveralls.io/github/yzhao062/pyod :alt: Coverage Status
.. |badge_maintainability| image:: https://api.codeclimate.com/v1/badges/bdc3d8d0454274c753c4/maintainability :target: https://codeclimate.com/github/yzhao062/Pyod/maintainability :alt: Maintainability
.. |badge_license| image:: https://img.shields.io/github/license/yzhao062/pyod.svg :target: https://github.com/yzhao062/pyod/blob/master/LICENSE :alt: License
.. |badge_benchmark| image:: https://img.shields.io/badge/ADBench-benchmark_results-pink :target: https://github.com/Minqi824/ADBench :alt: Benchmark
Read Me First ^^^^^^^^^^^^^
Welcome to PyOD, a well-developed and easy-to-use Python library for detecting anomalies in multivariate data. Whether you are working with a small-scale project or large datasets, PyOD provides a range of algorithms to fit your needs.
PyOD Version 2 is now available (Paper <https://www.arxiv.org/abs/2412.12154>) [#Chen2024PyOD], featuring:
- Expanded Deep Learning Support: Integrates 12 modern neural models into a single PyTorch-based framework, bringing the total number of outlier detection methods to 45.
- Enhanced Performance and Ease of Use: Models are optimized for efficiency and consistent performance across different datasets.
- LLM-based Model Selection: Automated model selection guided by a large language model reduces manual tuning and assists users who may have limited experience with outlier detection.
Additional Resources:
- NLP Anomaly Detection:
NLP-ADBench <https://github.com/USC-FORTIS/NLP-ADBench>_ provides both NLP anonaly detection datasets and algorithms - Time-series Outlier Detection:
TODS <https://github.com/datamllab/tods>_ - Graph Outlier Detection:
PyGOD <https://pygod.org/>_ - Performance Comparison & Datasets: Our 45-page
anomaly detection benchmark paper <https://openreview.net/forum?id=foA_SFQ9zo0>_ andADBench <https://github.com/Minqi824/ADBench>_, comparing 30 algorithms on 57 datasets - PyOD on Distributed Systems:
PyOD on Databricks <https://www.databricks.com/blog/2023/03/13/unsupervised-outlier-detection-databricks.html>_ - Learn More:
Anomaly Detection Resources <https://github.com/yzhao062/anomaly-detection-resources>_
Check out our latest research in 2025 on LLM-based anomaly detection [#Yang2024ad]: AD-LLM: Benchmarking Large Language Models for Anomaly Detection <https://arxiv.org/abs/2412.11142>.
About PyOD ^^^^^^^^^^
PyOD, established in 2017, has become a go-to Python library for detecting anomalous/outlying objects in multivariate data. This exciting yet challenging field is commonly referred to as Outlier Detection <https://en.wikipedia.org/wiki/Anomaly_detection>_ or Anomaly Detection <https://en.wikipedia.org/wiki/Anomaly_detection>_.
PyOD includes more than 50 detection algorithms, from classical LOF (SIGMOD 2000) to the cutting-edge ECOD and DIF (TKDE 2022 and 2023). Since 2017, PyOD has been successfully used in numerous academic research projects and commercial products with more than 26 million downloads <https://pepy.tech/project/pyod>. It is also well acknowledged by the machine learning community with various dedicated posts/tutorials, including Analytics Vidhya <https://www.analyticsvidhya.com/blog/2019/02/outlier-detection-python-pyod/>, KDnuggets <https://www.kdnuggets.com/2019/02/outlier-detection-methods-cheat-sheet.html>, and Towards Data Science <https://towardsdatascience.com/anomaly-detection-for-dummies-15f148e559c1>.
PyOD is featured for:
- Unified, User-Friendly Interface across various algorithms.
- Wide Range of Models, from classic techniques to the latest deep learning methods in PyTorch.
- High Performance & Efficiency, leveraging
numba <https://github.com/numba/numba>_ andjoblib <https://github.com/joblib/joblib>_ for JIT compilation and parallel processing. - Fast Training & Prediction, achieved through the SUOD framework [#Zhao2021SUOD]_.
Outlier Detection with 5 Lines of Code:
.. code-block:: python
# Example: Training an ECOD detector
from pyod.models.ecod import ECOD
clf = ECOD()
clf.fit(X_train)
y_train_scores = clf.decision_scores_ # Outlier scores for training data
y_test_scores = clf.decision_function(X_test) # Outlier scores for test data
Selecting the Right Algorithm: Unsure where to start? Consider these robust and interpretable options:
ECOD <https://github.com/yzhao062/pyod/blob/master/examples/ecod_example.py>_: Example of using ECOD for outlier detectionIsolation Forest <https://github.com/yzhao062/pyod/blob/master/examples/iforest_example.py>_: Example of using Isolation Forest for outlier detection
Alternatively, explore MetaOD <https://github.com/yzhao062/MetaOD>_ for a data-driven approach.
Citing PyOD:
If you use PyOD in a scientific publication, we would appreciate citations to the following paper(s):
PyOD 2: A Python Library for Outlier Detection with LLM-powered Model Selection <https://arxiv.org/abs/2412.12154>_ is available as a preprint. If you use PyOD in a scientific publication, we would appreciate citations to the following paper::
@inproceedings{chen2025pyod,
title={Pyod 2: A python library for outlier detection with llm-powered model selection},
author={Chen, Sihan and Qian, Zhuangzhuang and Siu, Wingchun and Hu, Xingcan and Li, Jiaqi and Li, Shawn and Qin, Yuehan and Yang, Tiankai and Xiao, Zhuo and Ye, Wanghao and others},
booktitle={Companion Proceedings of the ACM on Web Conference 2025},
pages={2807--2810},
year={2025}
}
PyOD paper <http://www.jmlr.org/papers/volume20/19-011/19-011.pdf>_ is published in Journal of Machine Learning Research (JMLR) <http://www.jmlr.org/>_ (MLOSS track).::
@article{zhao2019pyod,
author = {Zhao, Yue and Nasrullah, Zain and Li, Zheng},
title = {PyOD: A Python Toolbox for Scalable Outlier Detection},
journal = {Journal of Machine Learning Research},
year = {2019},
volume = {20},
number = {96},
pages = {1-7},
url = {http://jmlr.org/papers/v20/19-011.html}
}
or::
Zhao, Y., Nasrullah, Z. and Li, Z., 2019. PyOD: A Python Toolbox for Scalable Outlier Detection. Journal of machine learning research (JMLR), 20(96), pp.1-7.
For a broader perspective on anomaly detection, see our NeurIPS papers ADBench: Anomaly Detection Benchmark Paper <https://arxiv.org/abs/2206.09426>_ and ADGym: Design Choices for Deep Anomaly Detection <https://arxiv.org/abs/2309.15376>_::
@article{han2022adbench,
title={Adbench: Anomaly detection benchmark},
author={Han, Songqiao and Hu, Xiyang and Huang, Hailiang and Jiang, Minqi and Zhao, Yue},
journal={Advances in Neural Information Processing Systems},
volume={35},
pages={32142--32159},
year={2022}
}
@article{jiang2023adgym,
title={ADGym: Design Choices for Deep Anomaly Detection},
author={Jiang, Minqi and Hou, Chaochuan and Zheng, Ao and Han, Songqiao and Huang, Hailiang and Wen, Qingsong and Hu, Xiyang and Zhao, Yue},
journal={Advances in Neural Information Processing Systems},
volume={36},
year={2023}
}
Table of Contents:
Installation <#installation>_API Cheatsheet & Reference <#api-cheatsheet--reference>_ADBench Benchmark and Datasets <#adbench-benchmark-and-datasets>_Model Save & Load <#model-save--load>_Fast Train with SUOD <#fast-train-with-suod>_Thresholding Outlier Scores <#thresholding-outlier-scores>_Implemented Algorithms <#implemented-algorithms>_Quick Start for Outlier Detection <#quick-start-for-outlier-detection>_How to Contribute <#how-to-contribute>_Inclusion Criteria <#inclusion-criteria>_
Installation ^^^^^^^^^^^^
PyOD is designed for easy installation using either pip or conda. We recommend using the latest version of PyOD due to frequent updates and enhancements:
.. code-block:: bash
pip install pyod # normal install pip install --upgrade pyod # or update if needed
.. code-block:: bash
conda install -c conda-forge pyod
Alternatively, you can clone and run the setup.py file:
.. code-block:: bash
git clone https://github.com/yzhao062/pyod.git cd pyod pip insta
Related Skills
claude-opus-4-5-migration
82.0kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
333.3kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
feishu-drive
333.3k|
things-mac
333.3kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
