index.rst
1 .. pyod documentation master file, created by 2 sphinx-quickstart on Sun May 27 10:56:38 2018. 3 You can adapt this file completely to your liking, but it should at least 4 contain the root `toctree` directive. 5 6 Welcome to PyOD 3 documentation! 7 ================================= 8 9 10 .. image:: https://img.shields.io/pypi/v/pyod.svg?color=brightgreen 11 :target: https://pypi.org/project/pyod/ 12 :alt: PyPI version 13 14 15 .. image:: https://anaconda.org/conda-forge/pyod/badges/version.svg 16 :target: https://anaconda.org/conda-forge/pyod 17 :alt: Anaconda version 18 19 20 .. image:: https://readthedocs.org/projects/pyod/badge/?version=latest 21 :target: https://pyod.readthedocs.io/en/latest/?badge=latest 22 :alt: Documentation status 23 24 25 .. image:: https://img.shields.io/github/stars/yzhao062/pyod.svg 26 :target: https://github.com/yzhao062/pyod/stargazers 27 :alt: GitHub stars 28 29 30 .. image:: https://img.shields.io/github/forks/yzhao062/pyod.svg?color=blue 31 :target: https://github.com/yzhao062/pyod/network 32 :alt: GitHub forks 33 34 35 .. image:: https://pepy.tech/badge/pyod 36 :target: https://pepy.tech/project/pyod 37 :alt: Downloads 38 39 .. image:: https://github.com/yzhao062/pyod/actions/workflows/testing.yml/badge.svg 40 :target: https://github.com/yzhao062/pyod/actions/workflows/testing.yml 41 :alt: Testing 42 43 44 .. image:: https://coveralls.io/repos/github/yzhao062/pyod/badge.svg 45 :target: https://coveralls.io/github/yzhao062/pyod 46 :alt: Coverage Status 47 48 49 .. image:: https://api.codeclimate.com/v1/badges/bdc3d8d0454274c753c4/maintainability 50 :target: https://codeclimate.com/github/yzhao062/Pyod/maintainability 51 :alt: Maintainability 52 53 54 .. image:: https://img.shields.io/github/license/yzhao062/pyod.svg 55 :target: https://github.com/yzhao062/pyod/blob/master/LICENSE 56 :alt: License 57 58 59 .. image:: https://img.shields.io/badge/ADBench-benchmark_results-pink 60 :target: https://github.com/Minqi824/ADBench 61 :alt: Benchmark 62 63 ---- 64 65 .. note:: 66 67 **New in V3.** Any AI agent can now run expert-level anomaly detection on your data. Just ask. 68 69 PyOD 3 is the most comprehensive Python library for anomaly detection. Four pillars: 70 71 =========================== ======================================================================================== 72 Pillar What it means 73 =========================== ======================================================================================== 74 Multi-Modal 60+ detectors across **tabular, time series, graph, text, and image** data, one API 75 Full Lifecycle From raw data to explained anomalies and next-step guidance in a single call 76 Agentic Ask in plain English, and AI agents run expert-level detection without OD expertise 77 Most Used `38+ million downloads <https://pepy.tech/project/pyod>`_; benchmark-backed routing (ADBench, TSB-AD, BOND, NLP-ADBench) 78 =========================== ======================================================================================== 79 80 Install 81 ^^^^^^^ 82 83 Core library (required for every activation path): 84 85 .. code-block:: bash 86 87 pip install pyod 88 89 Then pick the activation path that matches your agent stack: 90 91 .. code-block:: bash 92 93 # 1. Claude Code / Claude Desktop / Codex — enables the od-expert skill 94 pyod install skill # Claude Code / Desktop: user-global (~/.claude/skills/) 95 pyod install skill --project # Codex: project-local (./skills/, Codex has no user-global dir) 96 97 # 2. Any MCP-compatible LLM — requires the optional mcp extra 98 pip install pyod[mcp] 99 pyod mcp serve # alias for `python -m pyod.mcp_server` 100 101 # 3. Pure Python — no extra step 102 # from pyod.utils.ad_engine import ADEngine 103 104 Run ``pyod info`` at any time to see version, detector counts, and 105 the install state of each activation path. ``pyod info`` also detects 106 which agent stack you have installed (``~/.claude/`` for Claude Code, 107 ``~/.codex/`` for Codex) and recommends the right install command. 108 109 For conda, source install, dependency details, and troubleshooting, 110 see the full :doc:`installation guide <install>`. The legacy 111 ``pyod-install-skill`` command from v3.0.0 still works as an alias 112 for ``pyod install skill``. 113 114 **Outlier Detection with 5 Lines of Code** (``pip install pyod``): 115 116 .. code-block:: python 117 118 from pyod.models.iforest import IForest 119 clf = IForest() 120 clf.fit(X_train) 121 y_train_scores = clf.decision_scores_ # training anomaly scores 122 y_test_scores = clf.decision_function(X_test) # test anomaly scores 123 124 **Three ways to use PyOD:** 125 126 ========= ===================== ====================================================================== ============================ 127 Layer Name When to use Entry point 128 ========= ===================== ====================================================================== ============================ 129 1 Classic API You know which detector you want :doc:`examples/tabular` 130 2 ADEngine You want PyOD to choose, compare, and assess automatically :doc:`examples/adengine` 131 3 Agentic Investigation You want an AI agent to drive OD through natural conversation :doc:`examples/agentic` 132 ========= ===================== ====================================================================== ============================ 133 134 Layers 2 and 3 are powered by :class:`~pyod.utils.ad_engine.ADEngine`, PyOD's intelligent orchestration core. Layer 3 adds the ``od-expert`` skill that auto-activates in Claude Code, Codex, and MCP-compatible agents. 135 136 .. figure:: figs/agentic-demo.png 137 :alt: PyOD 3 agentic investigation demo on cardiotocography dataset 138 :align: center 139 :width: 720 140 141 A real 5-turn agentic conversation on the UCI Cardiotocography 142 dataset (1,831 recordings, 21 clinical features). 143 144 See :doc:`examples/agentic` for the full walkthrough. 145 146 **How PyOD 3 gets triggered:** 147 148 See the Install block above for setup instructions for all three activation paths. The legacy ``pyod-install-skill`` command from v3.0.0 still works as an alias for ``pyod install skill``. 149 150 **PyOD Ecosystem & Resources**: 151 `ADBench <https://github.com/Minqi824/ADBench>`_ (tabular benchmark) :cite:`a-han2022adbench` | `TSB-AD <https://github.com/TheDatumOrg/TSB-AD>`_ (time series) :cite:`a-liu2024tsb` | `BOND <https://arxiv.org/abs/2206.10071>`_ (graph) :cite:`a-liu2022bond` | `NLP-ADBench <https://github.com/USC-FORTIS/NLP-ADBench>`_ (NLP) :cite:`a-li2024nlp` | `AD-LLM <https://arxiv.org/abs/2412.11142>`_ (LLM-based AD) :cite:`a-yang2024ad` | `Resources <https://github.com/yzhao062/anomaly-detection-resources>`_ 152 153 ---- 154 155 About PyOD 156 ^^^^^^^^^^ 157 158 PyOD, established in 2017, is the longest-running and most widely used Python library for `anomaly detection <https://en.wikipedia.org/wiki/Anomaly_detection>`_. With `38+ million downloads <https://pepy.tech/project/pyod>`_, it serves both academic research and commercial products worldwide. 159 160 V3 extends the library with :class:`~pyod.utils.ad_engine.ADEngine` (intelligent orchestration) and the ``od-expert`` skill (agentic workflow), while keeping the classic ``fit``/``predict`` API fully backward-compatible. V3 is built on SUOD :cite:`a-zhao2021suod` for fast parallel training and numba JIT for per-model speedups. 161 162 **Citing PyOD**: 163 164 If you use PyOD in a scientific publication, we would appreciate citations to the following paper(s): 165 166 `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:: 167 168 @inproceedings{chen2025pyod, 169 title={Pyod 2: A python library for outlier detection with llm-powered model selection}, 170 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}, 171 booktitle={Companion Proceedings of the ACM on Web Conference 2025}, 172 pages={2807--2810}, 173 year={2025} 174 } 175 176 `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).:: 177 178 @article{zhao2019pyod, 179 author = {Zhao, Yue and Nasrullah, Zain and Li, Zheng}, 180 title = {PyOD: A Python Toolbox for Scalable Outlier Detection}, 181 journal = {Journal of Machine Learning Research}, 182 year = {2019}, 183 volume = {20}, 184 number = {96}, 185 pages = {1-7}, 186 url = {http://jmlr.org/papers/v20/19-011.html} 187 } 188 189 or:: 190 191 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. 192 193 194 For a broader perspective on anomaly detection, see our NeurIPS papers on `ADBench <https://arxiv.org/abs/2206.09426>`_ :cite:`a-han2022adbench` and `ADGym <https://arxiv.org/abs/2309.15376>`_. 195 196 197 ---- 198 199 Benchmarks 200 ^^^^^^^^^^ 201 202 * `ADBench <https://github.com/Minqi824/ADBench>`_ :cite:`a-han2022adbench`: 30 algorithms on 57 tabular datasets. See `comparison <https://github.com/yzhao062/pyod/blob/master/examples/compare_all_models.py>`_. 203 * `NLP-ADBench <https://github.com/USC-FORTIS/NLP-ADBench>`_ :cite:`a-li2024nlp`: 19 methods on 8 text datasets. Two-step (embedding + detector) beats end-to-end. 204 * `TSB-AD <https://github.com/TheDatumOrg/TSB-AD>`_ :cite:`a-liu2024tsb`: 40 algorithms on 1070 time series datasets (NeurIPS 2024). 205 * `BOND <https://arxiv.org/abs/2206.10071>`_ :cite:`a-liu2022bond`: 14 graph anomaly detection algorithms on 14 datasets (NeurIPS 2022). 206 207 208 Implemented Algorithms 209 ====================== 210 211 PyOD is organized into two functional groups: **(i) Detection Algorithms**, with dedicated subsections for tabular, time series, and graph data (EmbeddingOD inside the tabular table adds multi-modal support for text and image via foundation model encoders); and **(ii) Utility Functions** for data generation, evaluation, and intelligent orchestration. 212 213 **(i-a) Tabular & Multi-Modal Detection Algorithms** : 214 215 =================== ================ ====================================================================================================== ===== =================================================== ====================================================== 216 Type Abbr Algorithm Year Class Ref 217 =================== ================ ====================================================================================================== ===== =================================================== ====================================================== 218 Probabilistic ECOD Unsupervised Outlier Detection Using Empirical Cumulative Distribution Functions 2022 :class:`pyod.models.ecod.ECOD` :cite:`a-li2021ecod` 219 Probabilistic COPOD COPOD: Copula-Based Outlier Detection 2020 :class:`pyod.models.copod.COPOD` :cite:`a-li2020copod` 220 Probabilistic ABOD Angle-Based Outlier Detection 2008 :class:`pyod.models.abod.ABOD` :cite:`a-kriegel2008angle` 221 Probabilistic FastABOD Fast Angle-Based Outlier Detection using approximation 2008 :class:`pyod.models.abod.ABOD` :cite:`a-kriegel2008angle` 222 Probabilistic MAD Median Absolute Deviation (MAD) 1993 :class:`pyod.models.mad.MAD` :cite:`a-iglewicz1993detect` 223 Probabilistic SOS Stochastic Outlier Selection 2012 :class:`pyod.models.sos.SOS` :cite:`a-janssens2012stochastic` 224 Probabilistic QMCD Quasi-Monte Carlo Discrepancy outlier detection 2001 :class:`pyod.models.qmcd.QMCD` :cite:`a-fang2001wrap` 225 Probabilistic KDE Outlier Detection with Kernel Density Functions 2007 :class:`pyod.models.kde.KDE` :cite:`a-latecki2007outlier` 226 Probabilistic Sampling Rapid distance-based outlier detection via sampling 2013 :class:`pyod.models.sampling.Sampling` :cite:`a-sugiyama2013rapid` 227 Probabilistic GMM Probabilistic Mixture Modeling for Outlier Analysis :class:`pyod.models.gmm.GMM` :cite:`a-aggarwal2015outlier` [Ch.2] 228 Linear Model PCA Principal Component Analysis (the sum of weighted projected distances to the eigenvector hyperplanes) 2003 :class:`pyod.models.pca.PCA` :cite:`a-shyu2003novel` 229 Linear Model KPCA Kernel Principal Component Analysis 2007 :class:`pyod.models.kpca.KPCA` :cite:`a-hoffmann2007kernel` 230 Linear Model MCD Minimum Covariance Determinant (use the mahalanobis distances as the outlier scores) 1999 :class:`pyod.models.mcd.MCD` :cite:`a-rousseeuw1999fast,a-hardin2004outlier` 231 Linear Model CD Use Cook's distance for outlier detection 1977 :class:`pyod.models.cd.CD` :cite:`a-cook1977detection` 232 Linear Model OCSVM One-Class Support Vector Machines 2001 :class:`pyod.models.ocsvm.OCSVM` :cite:`a-scholkopf2001estimating` 233 Linear Model LMDD Deviation-based Outlier Detection (LMDD) 1996 :class:`pyod.models.lmdd.LMDD` :cite:`a-arning1996linear` 234 Proximity-Based LOF Local Outlier Factor 2000 :class:`pyod.models.lof.LOF` :cite:`a-breunig2000lof` 235 Proximity-Based COF Connectivity-Based Outlier Factor 2002 :class:`pyod.models.cof.COF` :cite:`a-tang2002enhancing` 236 Proximity-Based Incr. COF Memory Efficient Connectivity-Based Outlier Factor (slower but reduce storage complexity) 2002 :class:`pyod.models.cof.COF` :cite:`a-tang2002enhancing` 237 Proximity-Based CBLOF Clustering-Based Local Outlier Factor 2003 :class:`pyod.models.cblof.CBLOF` :cite:`a-he2003discovering` 238 Proximity-Based LOCI LOCI: Fast outlier detection using the local correlation integral 2003 :class:`pyod.models.loci.LOCI` :cite:`a-papadimitriou2003loci` 239 Proximity-Based HBOS Histogram-based Outlier Score 2012 :class:`pyod.models.hbos.HBOS` :cite:`a-goldstein2012histogram` 240 Proximity-Based HDBSCAN Density-based clustering based on hierarchical density estimates 2013 :class:`pyod.models.hdbscan.HDBSCAN` :cite:`a-campello2013density` 241 Proximity-Based kNN k Nearest Neighbors (use the distance to the kth nearest neighbor as the outlier score 2000 :class:`pyod.models.knn.KNN` :cite:`a-ramaswamy2000efficient,a-angiulli2002fast` 242 Proximity-Based AvgKNN Average kNN (use the average distance to k nearest neighbors as the outlier score) 2002 :class:`pyod.models.knn.KNN` :cite:`a-ramaswamy2000efficient,a-angiulli2002fast` 243 Proximity-Based MedKNN Median kNN (use the median distance to k nearest neighbors as the outlier score) 2002 :class:`pyod.models.knn.KNN` :cite:`a-ramaswamy2000efficient,a-angiulli2002fast` 244 Proximity-Based SOD Subspace Outlier Detection 2009 :class:`pyod.models.sod.SOD` :cite:`a-kriegel2009outlier` 245 Proximity-Based ROD Rotation-based Outlier Detection 2020 :class:`pyod.models.rod.ROD` :cite:`a-almardeny2020novel` 246 Outlier Ensembles IForest Isolation Forest 2008 :class:`pyod.models.iforest.IForest` :cite:`a-liu2008isolation,a-liu2012isolation` 247 Outlier Ensembles INNE Isolation-based Anomaly Detection Using Nearest-Neighbor Ensembles 2018 :class:`pyod.models.inne.INNE` :cite:`a-bandaragoda2018isolation` 248 Outlier Ensembles DIF Deep Isolation Forest for Anomaly Detection 2023 :class:`pyod.models.dif.DIF` :cite:`a-xu2023dif` 249 Outlier Ensembles FB Feature Bagging 2005 :class:`pyod.models.feature_bagging.FeatureBagging` :cite:`a-lazarevic2005feature` 250 Outlier Ensembles LSCP LSCP: Locally Selective Combination of Parallel Outlier Ensembles 2019 :class:`pyod.models.lscp.LSCP` :cite:`a-zhao2019lscp` 251 Outlier Ensembles XGBOD Extreme Boosting Based Outlier Detection **(Supervised)** 2018 :class:`pyod.models.xgbod.XGBOD` :cite:`a-zhao2018xgbod` 252 Outlier Ensembles LODA Lightweight On-line Detector of Anomalies 2016 :class:`pyod.models.loda.LODA` :cite:`a-pevny2016loda` 253 Outlier Ensembles SUOD SUOD: Accelerating Large-scale Unsupervised Heterogeneous Outlier Detection **(Acceleration)** 2021 :class:`pyod.models.suod.SUOD` :cite:`a-zhao2021suod` 254 Neural Networks AutoEncoder Fully connected AutoEncoder (use reconstruction error as the outlier score) 2015 :class:`pyod.models.auto_encoder.AutoEncoder` :cite:`a-aggarwal2015outlier` [Ch.3] 255 Neural Networks VAE Variational AutoEncoder (use reconstruction error as the outlier score) 2013 :class:`pyod.models.vae.VAE` :cite:`a-kingma2013auto` 256 Neural Networks Beta-VAE Variational AutoEncoder (all customized loss term by varying gamma and capacity) 2018 :class:`pyod.models.vae.VAE` :cite:`a-burgess2018understanding` 257 Neural Networks SO_GAAL Single-Objective Generative Adversarial Active Learning 2019 :class:`pyod.models.so_gaal.SO_GAAL` :cite:`a-liu2019generative` 258 Neural Networks MO_GAAL Multiple-Objective Generative Adversarial Active Learning 2019 :class:`pyod.models.mo_gaal.MO_GAAL` :cite:`a-liu2019generative` 259 Neural Networks DeepSVDD Deep One-Class Classification 2018 :class:`pyod.models.deep_svdd.DeepSVDD` :cite:`a-ruff2018deepsvdd` 260 Neural Networks AnoGAN Anomaly Detection with Generative Adversarial Networks 2017 :class:`pyod.models.anogan.AnoGAN` :cite:`a-schlegl2017unsupervised` 261 Neural Networks ALAD Adversarially learned anomaly detection 2018 :class:`pyod.models.alad.ALAD` :cite:`a-zenati2018adversarially` 262 Neural Networks DevNet Deep Anomaly Detection with Deviation Networks 2019 :class:`pyod.models.devnet.DevNet` :cite:`a-pang2019deep` 263 Neural Networks AE1SVM Autoencoder-based One-class Support Vector Machine 2019 :class:`pyod.models.ae1svm.AE1SVM` :cite:`a-nguyen2019scalable` 264 Graph-based R-Graph Outlier detection by R-graph 2017 :class:`pyod.models.rgraph.RGraph` :cite:`a-you2017provable` 265 Graph-based LUNAR LUNAR: Unifying Local Outlier Detection Methods via Graph Neural Networks 2022 :class:`pyod.models.lunar.LUNAR` :cite:`a-goodge2022lunar` 266 Embedding-based EmbeddingOD Multi-modal anomaly detection via foundation model embeddings (text, image) 2025 :class:`pyod.models.embedding.EmbeddingOD` :cite:`a-li2024nlp` 267 =================== ================ ====================================================================================================== ===== =================================================== ====================================================== 268 269 270 Ensemble methods (IForest, INNE, DIF, FB, LSCP, LODA, SUOD, XGBOD) are included in the table above. Score combination functions (average, maximization, AOM, MOA, median, majority vote) are in :mod:`pyod.models.combination`. 271 272 **(i-b) Time Series Anomaly Detection** : 273 274 All time series detectors use the same ``fit``/``predict``/``decision_function`` API as tabular detectors, with one exception: ``MatrixProfile`` is transductive (train-only; use ``decision_scores_`` and ``labels_`` after ``fit()``, no out-of-sample ``predict``). 275 276 **Input format**: numpy array of shape ``(n_timestamps,)`` for univariate or ``(n_timestamps, n_channels)`` for multivariate. Each row is one timestep; columns are channels/features. Pandas DataFrames and lists are auto-converted. **Output**: ``decision_scores_`` of shape ``(n_timestamps,)`` with one anomaly score per timestep. 277 278 **Time series detection in 3 lines**: 279 280 .. code-block:: python 281 282 from pyod.models.ts_kshape import KShape # or any TS detector 283 clf = KShape(window_size=20) 284 clf.fit(X_train) # shape (n_timestamps,) or (n_timestamps, n_channels) 285 scores = clf.decision_scores_ # per-timestamp anomaly scores 286 287 Algorithm rankings from `TSB-AD benchmark <https://github.com/TheDatumOrg/TSB-AD>`_ :cite:`a-liu2024tsb` (NeurIPS 2024, 1070 datasets): 288 289 =================== ================== ====================================================================================================== ===== ============================================================== ====================================================== 290 Type Abbr Algorithm Year Class Ref 291 =================== ================== ====================================================================================================== ===== ============================================================== ====================================================== 292 Windowed Bridge TimeSeriesOD Any PyOD detector on sliding windows of time series 2026 :class:`pyod.models.ts_od.TimeSeriesOD` 293 Subsequence MatrixProfile Matrix Profile (STOMP): nearest-neighbor distance, transductive (train-only) 2016 :class:`pyod.models.ts_matrix_profile.MatrixProfile` :cite:`a-yeh2016matrix` 294 Frequency SpectralResidual Spectral Residual: FFT-based saliency detection 2019 :class:`pyod.models.ts_spectral_residual.SpectralResidual` :cite:`a-ren2019time` 295 Clustering KShape k-Shape clustering for subsequence anomaly detection (#2 in TSB-AD) 2015 :class:`pyod.models.ts_kshape.KShape` :cite:`a-paparrizos2015kshape` 296 Streaming SAND Streaming anomaly detection with drift adaptation (experimental) 2021 :class:`pyod.models.ts_sand.SAND` :cite:`a-boniol2021sand` 297 Deep Learning LSTMAD LSTM prediction error with Mahalanobis distance scoring 2015 :class:`pyod.models.ts_lstm.LSTMAD` :cite:`a-malhotra2015long` 298 Deep Learning AnomalyTransformer Transformer with association discrepancy (experimental) 2022 :class:`pyod.models.ts_anomaly_transformer.AnomalyTransformer` :cite:`a-xu2022anomaly` 299 =================== ================== ====================================================================================================== ===== ============================================================== ====================================================== 300 301 302 **(i-c) Graph Anomaly Detection** (``pip install pyod[graph]``): 303 304 All graph detectors are **transductive** in v1: use ``decision_scores_`` and ``labels_`` after ``fit()``. No out-of-sample ``predict``. Input: PyG ``Data`` object with ``x`` (node features) and ``edge_index`` (COO edges). SCAN works without features. 305 306 **Graph detection in 3 lines** (``pip install pyod[graph]``): 307 308 .. code-block:: python 309 310 from pyod.models.pyg_dominant import DOMINANT 311 clf = DOMINANT(hidden_dim=64, epochs=100) 312 clf.fit(data) # PyG Data object 313 scores = clf.decision_scores_ # per-node anomaly scores 314 315 Algorithm rankings from `BOND benchmark <https://arxiv.org/abs/2206.10071>`_ :cite:`a-liu2022bond` (NeurIPS 2022, 14 datasets): 316 317 .. list-table:: 318 :widths: 18 18 45 5 25 10 319 :header-rows: 1 320 321 * - Type 322 - Abbr 323 - Algorithm 324 - Year 325 - Class 326 - Ref 327 * - GCN Autoencoder 328 - DOMINANT 329 - GCN AE, structure + attribute reconstruction (#1 BOND deep) 330 - 2019 331 - :class:`pyod.models.pyg_dominant.DOMINANT` 332 - :cite:`a-ding2019dominant` 333 * - Contrastive 334 - CoLA 335 - Contrastive self-supervised, local neighbor context (#2 BOND deep) 336 - 2022 337 - :class:`pyod.models.pyg_cola.CoLA` 338 - :cite:`a-liu2022cola` 339 * - Contrastive+AE 340 - CONAD 341 - Contrastive with anomalous-view injection + dual reconstruction 342 - 2022 343 - :class:`pyod.models.pyg_conad.CONAD` 344 - :cite:`a-xu2022conad` 345 * - Attention AE 346 - AnomalyDAE 347 - GAT structure encoder + MLP attribute encoder 348 - 2020 349 - :class:`pyod.models.pyg_anomalydae.AnomalyDAE` 350 - :cite:`a-fan2020anomalydae` 351 * - Motif AE 352 - GUIDE 353 - Dual GCN AE on original + triangle-motif adjacency 354 - 2021 355 - :class:`pyod.models.pyg_guide.GUIDE` 356 - :cite:`a-yuan2021guide` 357 * - Matrix Factor. 358 - Radar 359 - Residual analysis via matrix factorization 360 - 2017 361 - :class:`pyod.models.pyg_radar.Radar` 362 - :cite:`a-li2017radar` 363 * - Matrix Factor. 364 - ANOMALOUS 365 - Joint MF with Laplacian regularization 366 - 2018 367 - :class:`pyod.models.pyg_anomalous.ANOMALOUS` 368 - :cite:`a-peng2018anomalous` 369 * - Structural 370 - SCAN 371 - Structural clustering, no features needed 372 - 2007 373 - :class:`pyod.models.pyg_scan.SCAN` 374 - :cite:`a-xu2007scan` 375 376 377 **(ii) Utility Functions**: 378 379 =================== =============================================== ===================================================================================================================================================== 380 Type Name Function 381 =================== =============================================== ===================================================================================================================================================== 382 Data :func:`~pyod.utils.data.generate_data` Synthesized data generation; normal data from multivariate Gaussian, outliers from uniform distribution 383 Data :func:`~pyod.utils.data.generate_data_clusters` Synthesized data generation in clusters for more complex patterns 384 Data :func:`~pyod.utils.data.generate_ts_data` Synthesized time series data with point and subsequence anomalies 385 Evaluation :func:`~pyod.utils.data.evaluate_print` Print ROC-AUC and Precision @ Rank n for a detector 386 Evaluation :func:`~pyod.utils.utility.precision_n_scores` Calculate Precision @ Rank n 387 Utility :func:`~pyod.utils.utility.get_label_n` Turn raw outlier scores into binary labels by assigning 1 to the top n scores 388 Stat :func:`~pyod.utils.stat_models.wpearsonr` Calculate the weighted Pearson correlation of two samples 389 Encoding :func:`~pyod.utils.encoders.resolve_encoder` Resolve an encoder from a string, BaseEncoder instance, or callable 390 Encoding SentenceTransformerEncoder Encode text via sentence-transformers models (see :doc:`pyod.utils <pyod.utils>`) 391 Encoding OpenAIEncoder Encode text via OpenAI Embeddings API (see :doc:`pyod.utils <pyod.utils>`) 392 Encoding HuggingFaceEncoder Encode text or images via HuggingFace transformers (see :doc:`pyod.utils <pyod.utils>`) 393 Intelligence :class:`~pyod.utils.ad_engine.ADEngine` Intelligent anomaly detection lifecycle engine: profiling, planning, execution, analysis, and reporting 394 =================== =============================================== ===================================================================================================================================================== 395 396 397 398 API Cheatsheet & Reference 399 ========================== 400 401 The following APIs are applicable for all detector models for easy use. 402 403 * :func:`pyod.models.base.BaseDetector.fit`: Fit detector. y is ignored in unsupervised methods. 404 * :func:`pyod.models.base.BaseDetector.decision_function`: Predict raw anomaly score of X using the fitted detector. 405 * :func:`pyod.models.base.BaseDetector.predict`: Predict if a particular sample is an outlier or not using the fitted detector. 406 * :func:`pyod.models.base.BaseDetector.predict_proba`: Predict the probability of a sample being outlier using the fitted detector. 407 * :func:`pyod.models.base.BaseDetector.predict_confidence`: Predict the model's sample-wise confidence (available in predict and predict_proba). 408 409 410 Key Attributes of a fitted model: 411 412 * :attr:`pyod.models.base.BaseDetector.decision_scores_`: The outlier scores of the training data. The higher, the more abnormal. 413 Outliers tend to have higher scores. 414 * :attr:`pyod.models.base.BaseDetector.labels_`: The binary labels of the training data. 0 stands for inliers and 1 for outliers/anomalies. 415 416 417 ---- 418 419 420 .. toctree:: 421 :maxdepth: 2 422 :hidden: 423 :caption: Getting Started 424 425 install 426 skill_maintenance 427 examples/index 428 benchmark 429 430 .. toctree:: 431 :maxdepth: 2 432 :hidden: 433 :caption: Advanced Topics 434 435 model_persistence 436 fast_train 437 thresholding 438 439 440 .. toctree:: 441 :maxdepth: 2 442 :hidden: 443 :caption: Documentation 444 445 api_cc 446 pyod.models.tabular 447 pyod.models.timeseries 448 pyod.models.graph 449 pyod.models.embedding 450 pyod.ad_engine 451 pyod.utils 452 453 454 .. toctree:: 455 :maxdepth: 2 456 :hidden: 457 :caption: Additional Information 458 459 impact 460 issues 461 relevant_knowledge 462 pubs 463 faq 464 about 465 466 467 ---- 468 469 470 .. rubric:: References 471 472 .. bibliography:: 473 :cited: 474 :labelprefix: A 475 :keyprefix: a-