logo

PyPI version Documentation status GitHub stars GitHub forks PyPI downloads testing Coverage Status License


PyGOD is a Python library for graph outlier detection (anomaly detection). This exciting yet challenging field has many key applications, e.g., detecting suspicious activities in social networks [DLS+20] and security systems [CCL+21].

PyGOD includes 10+ graph outlier detection algorithms. For consistency and accessibility, PyGOD is developed on top of PyTorch Geometric (PyG) and PyTorch, and follows the API design of PyOD. See examples below for detecting outliers with PyGOD in 5 lines!

PyGOD is featured for:

  • Unified APIs, detailed documentation, and interactive examples across various graph-based algorithms.

  • Comprehensive coverage of 10+ graph outlier detectors.

  • Full support of detections at multiple levels, such as node-, edge-, and graph-level tasks.

  • Scalable design for processing large graphs via mini-batch and sampling.

  • Streamline data processing with PyG–fully compatible with PyG data objects.

Outlier Detection Using PyGOD with 5 Lines of Code:

# train a dominant detector
from pygod.detector import DOMINANT

model = DOMINANT(num_layers=4, epoch=20)  # hyperparameters can be set here
model.fit(train_data)  # input data is a PyG data object

# get outlier scores on the training data (transductive setting)
score = model.decision_score_

# predict labels and scores on the testing data (inductive setting)
pred, score = model.predict(test_data, return_score=True)

Implemented Algorithms

Abbr

Year

Backbone

Sampling

Class

SCAN

2007

Clustering

No

pygod.detector.SCAN

GAE

2016

GNN+AE

Yes

pygod.detector.GAE

Radar

2017

MF

No

pygod.detector.Radar

ANOMALOUS

2018

MF

No

pygod.detector.ANOMALOUS

ONE

2019

MF

No

pygod.detector.ONE

DOMINANT

2019

GNN+AE

Yes

pygod.detector.DOMINANT

DONE

2020

MLP+AE

Yes

pygod.detector.DONE

AdONE

2020

MLP+AE

Yes

pygod.detector.AdONE

AnomalyDAE

2020

GNN+AE

Yes

pygod.detector.AnomalyDAE

GAAN

2020

GAN

Yes

pygod.detector.GAAN

DMGD

2020

GNN+AE

Yes

pygod.detector.DMGD

OCGNN

2021

GNN

Yes

pygod.detector.OCGNN

CoLA

2021

GNN+AE+SSL

Yes

pygod.detector.CoLA

GUIDE

2021

GNN+AE

Yes

pygod.detector.GUIDE

CONAD

2022

GNN+AE+SSL

Yes

pygod.detector.CONAD

GADNR

2024

GNN+AE

Yes

pygod.detector.GADNR