Layer 1: Graph Anomaly Detection¶
PyOD has 8 graph anomaly detectors built on PyTorch Geometric (PyG). Install with pip install pyod[graph]. All 8 are transductive in v1 – use decision_scores_ after fit().
from pyod.models.pyg_dominant import DOMINANT
import torch
from torch_geometric.data import Data
data = Data(x=torch.FloatTensor(X), edge_index=torch.LongTensor(edge_index))
clf = DOMINANT(hidden_dim=64, epochs=100)
clf.fit(data)
scores = clf.decision_scores_ # per-node anomaly scores
Detectors¶
Rankings from BOND benchmark (NeurIPS 2022):
Type |
Detector |
Year |
Venue |
|---|---|---|---|
GCN Autoencoder |
DOMINANT: GCN AE, structure + attribute |
2019 |
SDM |
Contrastive |
CoLA: local neighbor context |
2022 |
WWW |
Contrastive+AE |
CONAD: anomalous-view injection |
2022 |
PAKDD |
Attention AE |
AnomalyDAE: GAT + MLP dual AE |
2020 |
CIKM |
Motif AE |
GUIDE: triangle-motif dual AE |
2021 |
BigData |
Matrix Factor. |
Radar: residual analysis |
2017 |
IJCAI |
Matrix Factor. |
ANOMALOUS: CUR-style, Laplacian |
2018 |
IJCAI |
Structural |
SCAN: structural clustering |
2007 |
KDD |
Input Format¶
Primary: PyG Data object with x (node features) and edge_index (COO edges).
Convenience: numpy arrays for direct fit() calls:
clf.fit(X, edge_index=edge_index)
# X: numpy (n_nodes, n_features)
# edge_index: numpy (2, n_edges)
SCAN is the only structure-only detector – it works without node features. All others require data.x.