Correcting False Alarms from Unseen: Adapting Graph Anomaly Detectors at Test Time

January 23, 2026 · View on GitHub

This repository contains the official implementation for our paper:
"Correcting False Alarms from Unseen: Adapting Graph Anomaly Detectors at Test Time." Authors: Junjun Pan, Yixin Liu, Chuan Zhou, Fei Xiong, Alan Wee-Chung Liew, Shirui Pan*

Getting Started

1. Dataset Preparation

Run Prepare_dataset.ipynb to generate datasets with labeled normal and unseen-normal nodes.

  • Raw datasets can be downloaded from GADBench.
  • After downloading, place the files in the datasets_raw/ directory.
  • Running the notebook will generate preprocessed datasets. Note that:
    • The training and validation sets do not contain any unseen-normal nodes.

2. Running the Code

Once datasets are prepared:

  1. Place the pretrained model checkpoints (.pkl files) into the model_pkl/ directory.
  2. Run run.ipynb to evaluate and adapt the model at test time.

⚠️ If you're using a new backbone model, make sure to update the loading logic in pretrained_models.py accordingly.


Requirements

The code was tested with the following package versions:

torch==2.0.0
torch-cluster==1.6.3
torch-scatter==2.1.2
torch-sparse==0.6.18
torchaudio==2.0.0
torchdata==0.7.1
torchvision==0.15.0
dgl==1.1.2+cu117
scipy==1.11.4
scikit-image==0.24.0
scikit-learn==1.3.0
scikit-plot==0.3.7