异常检测工具包

以下工具包的具体使用请详见官网~

PyOD

PyOD 包括 30 多种检测算法,从经典的 LOF (SIGMOD 2000) 到最新的 SUOD (MLSys 2021) 和 ECOD (TKDE 2022)

# train the ECOD detector
from pyod.models.ecod import ECOD
clf = ECOD()
clf.fit(X_train)

# get outlier scores
y_train_scores = clf.decision_scores_  # raw outlier scores on the train data
y_test_scores = clf.decision_function(X_test)  # predict raw outlier scores on test

PyOD toolkit consists of three major functional groups:

  1. Individual Detection Algorithms
  2. Outlier Ensembles & Outlier Detector Combination Frameworks
  3. Utility Functions

PyTOD

为了将异常值检测 (OD) 扩展到大规模、高维数据集,我们提出了TOD,这是一种将 OD 算法抽象为基本张量操作以实现高效 GPU 加速的新系统。

# train the COPOD detector
from pytod.models.knn import KNN
clf = KNN() # default GPU device is used
clf.fit(X_train)

# get outlier scores
y_train_scores = clf.decision_scores_  # raw outlier scores on the train data
y_test_scores = clf.decision_function(X_test)  # predict raw outlier scores on test

PyGOD

PyGOD 是一个用于图异常检测(异常检测)的Python 库,里面包含10多种最新的基于图的检测算法,基于PyTorch Geometric (PyG),并遵循 PyOD 的 API设计。另外还有PyTOD(基于张量的离群点检测,通用gpu加速框架)

# train a dominant detector
from pygod.models import DOMINANT

model = DOMINANT()  # hyperparameters can be set here
model.fit(data)  # data is a Pytorch Geometric data object

# get outlier scores on the input data
outlier_scores = model.decision_scores # raw outlier scores on the input data

# predict on the new data
outlier_scores = model.decision_function(test_data) # raw outlier scores on the input data  # predict raw outlier scores on test

简化安装:

  • torch>=1.10
  • pytorch_geometric>=2.0.3
  • networkx>=2.6.3
    PyGOD toolkit consists of two major functional groups:
  1. Node-level detection
  2. Utility functions
posted @ 2022-10-15 15:33  Sharycxc  阅读(187)  评论(0)    收藏  举报