$ show yzhao062/pyod
PyOD is a comprehensive Python library for anomaly/outlier detection offering 60+ detectors across tabular, time series, graph, text, image, and audio modalities. It provides a classic scikit-learn-compatible API (fit/predict/decision_function) via pyod.models, a high-level orchestration engine (ADEngine) for automatic profiling, detector selection, consensus scoring, and reporting, and an agentic workflow layer for LLM-driven anomaly detection through CLI, MCP server, and packaged AI skills. The library is primarily a software library (application) with strong data research influence: it comes with benchmark-backed routing rules, academic references, and Jupyter notebooks for research reprocibility. Its architecture follows a three-layer design (classic detectors, ADEngine orchestration, agentic skills) that allows progressive engagement from simple model fitting to full automated pipelines.
The LLM identified 3 files worth highlighting for reuse:
Provides efficient implementations of Empirical Cumulative Distribution Function (ECDF), weighted Pearson correlation, and pairwise distance matrices accelerated via Numba JIT. These functions are self-contained (only depend on numpy, scipy, and numba) and can be extracted as a standalone statistical utilities package for any project requiring fast ECDF computation or robust correlations.
Factory functions wrapping over 20 thresholding methods from the pythers library (including AUCp, BOOT, CHAU, CPD, DEComp, IQR, MAD, etc.) into a unified interface. Each method returns a threshold value and an optional confidence score, and the module handles import fallbacks and parameter docs. It can be extracted as a reusable thresholding library for any anomaly detection score array.
Implements versioned model save/load with an envelope containing dependency versions, detector class, and thresholds. The compat_load function patches joblib's unpickler to handle scikit-learn Tree node dtype changes across versions (via _TREE_NODE_FIELD_DEFAULTS and dispatch table updates). This cross-version compatibility solution is a non-trivial pattern that could be extracted for any scikit-learn project needing robust model persistence across sklearn upgrades.