MCPcopy Index your code
hub / github.com/blacksingular/GHRN

github.com/blacksingular/GHRN @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
33 symbols 71 edges 3 files 2 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

GHRN: Addressing Heterophily in Graph Anomaly Detection: A Perspective of Graph Spectrum

This is a PyTorch implementation of

Addressing Heterophily in Graph Anomaly Detection: A Perspective of Graph Spectrum (WWW2023)

Overview

In this work, we aim to address the heterophily problem in the spectral domain. We point out that heterophily is positively associated with the frequency of a graph. Towards this end, we could prune inter-class edges by simply emphasizing and delineating the high-frequency components of the graph. We adopt graph Laplacian to measure the extent of 1-hop label changing of the center node and indicate high-frequency components. Our indicator can effectively reduce the heterophily degree of the graph and is less likely to be influenced by the prediction error.

Some questions

  1. What is heterophily and how does it affect the performance of the GNNs? Heterophily indicates the edges connecting nodes with different labels. Low-pass filters like GCN could undermine the discriminative information of the anomalies on heterophilous graphs.

  1. How does indicator work? GHRN will calculate the post-aggregation matrix for the graph, and a smaller value means a larger probability of the inter-class edges.

Dataset

YelpChi and Amazon can be downloaded from here or dgl.data.FraudDataset. The T-Finance and T-Social datasets developed in the paper are on google drive.

Dependencies

- pytorch 1.9.0
- dgl 0.8.1
- sympy
- argparse
- sklearn
- scipy
- pickle

Reproduce

python main.py --dataset tfinance
python main.py --dataset tfinance --del_ratio 0.015

Note that a delete ratio of 0 should be run first to get predictions y.

Also, here's an awesome implementation.

Acknowledgement

Our code references: - BWGNN

Reference

@inproceedings{
    gao2023ghrn,
    title={Addressing Heterophily in Graph Anomaly Detection: A Perspective of Graph Spectrum},
    author={Yuan Gao and Xiang Wang and Xiangnan He and Zhenguang Liu and Huamin Feng and Yongdong Zhang},
    booktitle={WWW},
    year={2023},
}

Core symbols most depended-on inside this repo

random_walk_update
called by 6
dataset.py
calculate_theta2
called by 2
BWGNN.py
train
called by 2
main.py
get_best_f1
called by 1
main.py
set_random_seed
called by 1
main.py
inner_product_black
called by 0
dataset.py
inner_product_white
called by 0
dataset.py
find_inter
called by 0
dataset.py

Shape

Method 15
Function 13
Class 5

Languages

Python100%

Modules by API surface

BWGNN.py19 symbols
dataset.py11 symbols
main.py3 symbols

For agents

$ claude mcp add GHRN \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact