项目 / AI4Risk/antifraud
A repository for financial fraud detection
本站整理,非 GitHub 官方 description。
官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。
以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。
该仓库通过解压数据集、运行预处理和矩阵生成脚本,并用 main.py 指定方法运行多种欺诈检测模型,配置在 yaml 中。
源文列出的实现包括卷积、时空注意力、图表示和图增强等方向的方法,并配有相应配置文件。实验使用 YelpChi、Amazon 和 S-FFSD 等数据集。运行前需按仓库说明准备环境和数据,再用 `python main.py --method` 指定方法做训练和评估。
来自 GitHub 仓库 README / 主页介绍正文,原样摘录,共 10,384 字节。
<h1 align="center">AntiFraud</h1>
<p align="center">
<a href="https://github.com/AI4Risk/antifraud/stargazers"><img src="https://img.shields.io/github/stars/AI4Risk/antifraud?style=flat-square" alt="GitHub stars"></a>
<a href="https://github.com/AI4Risk/antifraud/network/members"><img src="https://img.shields.io/github/forks/AI4Risk/antifraud?style=flat-square" alt="GitHub forks"></a>
<a href="https://github.com/AI4Risk/antifraud/blob/main/LICENSE"><img src="https://img.shields.io/github/license/AI4Risk/antifraud?style=flat-square" alt="License"></a>
<img src="https://img.shields.io/badge/Python-3.7%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.7 or later">
</p>
<p>
<b>A unified research framework for financial fraud detection.</b> Implementations of representative deep learning and graph-based fraud detection methods, with unified data processing, training, and evaluation pipelines.
</p>
<p align="center">
<a href="#antifraud-methods">🔬 Methods</a> ·
<a href="#antifraud-usage">🚀 Usage</a> ·
<a href="#antifraud-datasets">🗃️ Datasets</a> ·
<a href="#antifraud-results">📊 Results</a> ·
<a href="#antifraud-repository">🗂️ Repository</a> ·
<a href="#antifraud-citation">📚 Citation</a>
</p>
<a name="antifraud-methods"></a>
## 🔬 Implemented Methods
AntiFraud provides implementations of representative financial fraud detection methods spanning convolutional, spatio-temporal, graph-based, and graph augmentation approaches.
- `MCNN`: Credit card fraud detection using convolutional neural networks in [ICONIP 2016](https://link.springer.com/chapter/10.1007/978-3-319-46675-0_53).
- `STAN`: Spatio-temporal attention-based neural network for credit card fraud detection in [AAAI 2020](https://ojs.aaai.org/index.php/AAAI/article/view/5371).
- `STAGN`: Graph Neural Network for Fraud Detection via Spatial-temporal Attention in [TKDE 2020](https://ieeexplore.ieee.org/abstract/document/9204584/)
- `GTAN`: Semi-supervised Credit Card Fraud Detection via Attribute-driven Graph Representation in [AAAI 2023](https://ojs.aaai.org/index.php/AAAI/article/view/26702).
- `RGTAN`: Enhancing Attribute-driven Fraud Detection with Risk-aware Graph Representation in [TKDE 2025](https://ieeexplore.ieee.org/document/10896835)
- `HOGRL`: Effective High-order Graph Representation Learning for Credit Card Fraud Detection in [IJCAI 2024](https://arxiv.org/pdf/2503.01556).
- `Grad`: Grad: Guided Relation Diffusion Generation for Graph Augmentation in Graph Fraud Detection in [WWW 2025](https://dl.acm.org/doi/abs/10.1145/3696410.3714520).
<a name="antifraud-usage"></a>
## 🚀 Usage
### 📦 Requirements
```
python 3.7
scikit-learn 1.0.2
pandas 1.3.5
numpy 1.21.6
networkx 2.6.3
scipy 1.7.3
torch 1.12.1+cu113
dgl-cu113 0.8.1
```
### 📥 Data processing
1. Run `unzip /data/Amazon.zip` and `unzip /data/YelpChi.zip` to unzip the datasets;
2. Run `python feature_engineering/data_process.py` to pre-process all datasets needed in this repo.
3. Run `python feature_engineering/get_matrix.py` to generate the adjacency matrix of the high-order transaction graph.Please note that this will require approximately 280GB of storage space. Please be aware that if you intend to run `HOGRL` , you should first execute the `get_matrix.py` script.
> `Grad` is run on the DGL's `Amazon` and `Yelp` dataset.
### 🧠 Training & Evalutaion
<!--
To use fraud detection baselines including GBDT, LSTM, etc., simply run
```
python main.py --method LSTM
python main.py --method GBDT
```
You may change relevant configurations in `config/base_cfg.yaml`. -->
To test implementations of `MCNN`, `STAN` and `STAGN`, run
```
python main.py --method mcnn
python main.py --method stan
python main.py --method stagn
```
Configuration files can be found in `config/mcnn_cfg.yaml`, `config/stan_cfg.yaml` and `config/stagn_cfg.yaml`, respectively.
Models in `GTAN` and `RGTAN` can be run via:
```
python main.py --method gtan
python main.py --method rgtan
```
For specification of hyperparameters, please refer to `config/gtan_cfg.yaml` and `config/rgtan_cfg.yaml`.
Model in `HOGRL` can be run via:
```
python main.py --method hogrl
```
For specification of hyperparameters, please refer to `config/hogrl_cfg.yaml`.
To run the `Grad`, please read the [README of Grad](./methods/grad/README.md), including the environments and pipelines.
<a name="antifraud-datasets"></a>
## 🗃️ Datasets
There are three datasets, YelpChi, Amazon and S-FFSD, utilized for model experiments in this repository.
<!-- YelpChi and Amazon can be downloaded from [here](https://github.com/YingtongDou/CARE-GNN/tree/master/data) or [dgl.data.FraudDataset](https://docs.dgl.ai/api/python/dgl.data.html#fraud-dataset).
Put them in `/data` directory and run `unzip /data/Amazon.zip` and `unzip /data/YelpChi.zip` to unzip the datasets. -->
YelpChi and Amazon datasets are from [CARE-GNN](https://dl.acm.org/doi/abs/10.1145/3340531.3411903), whose original source data can be found in [this repository](https://github.com/YingtongDou/CARE-GNN/tree/master/data).
S-FFSD is a simulated & small version of finacial fraud semi-supervised dataset. Description of S-FFSD are listed as follows:
|Name|Type|Range|Note|
|--|--|--|--|
|Time|np.int32|from $\mathbf{0}$ to $\mathbf{N}$|$\mathbf{N}$ denotes the number of trasactions. |
|Source|string|from $\mathbf{S_0}$ to $\mathbf{S}_{ns}$|$ns$ denotes the number of transaction senders.|
|Target|string|from $\mathbf{T_0}$ to $\mathbf{T}_{nt}$ | $nt$ denotes the number of transaction reveicers.|
|Amount|np.float32|from **0.00** to **np.inf**|The amount of each transaction. |
|Location|string|from $\mathbf{L_0}$ to $\mathbf{L}_{nl}$ |$nl$ denotes the number of transacation locations.|
|Type|string|from $\mathbf{TP_0}$ to $\mathbf{TP}_{np}$|$np$ denotes the number of different transaction types. |
|Labels|np.int32|from **0** to **2**|**2** denotes **unlabeled**||
> We are looking for interesting public datasets! If you have any suggestions, please let us know!
<a name="antifraud-results"></a>
## 📊 Results
The performance of five models tested on three datasets are listed as follows:
| |YelpChi| | |Amazon| | |S-FFSD| | |
|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|
| |AUC|F1|AP|AUC|F1|AP|AUC|F1|AP|
|MCNN||- | -| -| -| -|0.7129|0.6861|0.3309|
|STAN|- |- | -| -| -| -|0.7446|0.6791|0.3395|
|STAGN|- |- | -| -| -| -|0.7659|0.6852|0.3599|
|GTAN|0.9241|0.7988|0.7513|0.9630|0.9213|0.8838|0.8286|0.7336|0.6585|
|RGTAN|0.9498|0.8492|0.8241|0.9750|0.9200|0.8926|0.8461|0.7513|0.6939|
|HOGRL|0.9808|0.8595|-|0.9800|0.9198|-|-|-|-|
|Grad|0.9908|-|0.9644|0.9789|-|0.8968|-|-|-|
> `MCNN`, `STAN` and `STAGN` are presently not applicable to YelpChi and Amazon datasets.
>
> `HOGRL` and `Grad` are presently not applicable to S-FFSD dataset.
<a name="antifraud-repository"></a>
## 🗂️ Repository
The repository is organized as follows:
```
AntiFraud/
├── config/ # Configuration files for different models
├── data/ # Dataset files
├── feature_engineering/ # Data preprocessing and graph construction
├── methods/ # Implementations of fraud detection methods
├── models/ # Pre-trained models for each method
├── main.py # Main entry point for model execution
└── requirements.txt # Package dependencies
```
<a name="antifraud-contributors"></a>
## 🤝 Contributors :
<a href="https://github.com/AI4Risk/antifraud/graphs/contributors">
<img src="https://contrib.rocks/image?repo=AI4Risk/antifraud" />
</a>
<a name="antifraud-citation"></a>
## 📚 Citation
If you find *Antifraud* is useful for your research, please consider citing the following papers:
@inproceedings{yang2025grad,
title={Grad: Guided relation diffusion generation for graph augmentation in graph fraud detection},
author={Yang, Jie and Zhang, Rui and Cheng, Ziyang and Cheng, Dawei and Yang, Guang and Wang, Bo},
booktitle={Proceedings of the ACM on Web Conference 2025},
pages={5308--5319},
year={2025}
}
@inproceedings{zou2024effective,
title={Effective High-order Graph Representation Learning for Credit Card Fraud Detection.},
author={Zou, Yao and Cheng, Dawei},
booktitle={International Joint Conference on Artificial Intelligence},
year={2024}
}
@ARTICLE{xiang2025enhancing,
author={Xiang, Sheng and Zhang, Guibin and Cheng, Dawei and Zhang, Ying},
journal={IEEE Transactions on Knowledge and Data Engineering},
title={Enhancing Attribute-Driven Fraud Detection With Risk-Aware Graph Representation},
year={2025},
pages={1-12},
doi={10.1109/TKDE.2025.3543887}
}
@inproceedings{Xiang2023SemiSupervisedCC,
title={Semi-supervised Credit Card Fraud Detection via Attribute-driven Graph Representation},
author={Sheng Xiang and Mingzhi Zhu and Dawei Cheng and Enxia Li and Ruihui Zhao and Yi Ouyang and Ling Chen and Yefeng Zheng},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
year={2023}
}
@article{cheng2020graph,
title={Graph Neural Network for Fraud Detection via Spatial-temporal Attention},
author={Cheng, Dawei and Wang, Xiaoyang and Zhang, Ying and Zhang, Liqing},
journal={IEEE Transactions on Knowledge and Data Engineering},
year={2020},
publisher={IEEE}
}
@inproceedings{cheng2020spatio,
title={Spatio-temporal attention-based neural network for credit card fraud detection},
author={Cheng, Dawei and Xiang, Sheng and Shang, Chencheng and Zhang, Yiyi and Yang, Fangzhou and Zhang, Liqing},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={34},
number={01},
pages={362--369},
year={2020}
}
@inproceedings{fu2016credit,
title={Credit card fraud detection using convolutional neural networks},
author={Fu, Kang and Cheng, Dawei and Tu, Yi and Zhang, Liqing},
booktitle={International Conference on Neural Information Processing},
pages={483--490},
year={2016},
organization={Springer}
}