Skip to content

Commit

Permalink
Add HACUD model
Browse files Browse the repository at this point in the history
  • Loading branch information
YingtongDou committed Jul 31, 2020
1 parent b0739e6 commit 3e502bf
Show file tree
Hide file tree
Showing 13 changed files with 83 additions and 14 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

**Introduction**

**DGFraud** is a Graph Neural Network (GNN) based toolbox for fraud detection. It integrates the implementation & comparison of state-of-the-art GNN-based fraud detection models. It also includes several utility functions such as graph preprocessing, graph sampling, and performance evaluation. The introduction of implemented models can be found [here](#implemented-models). <!-- (Add introduction blogs links). -->
**DGFraud** is a Graph Neural Network (GNN) based toolbox for fraud detection. It integrates the implementation & comparison of state-of-the-art GNN-based fraud detection models. The introduction of implemented models can be found [here](#implemented-models). <!-- (Add introduction blogs links). -->

We welcome contributions on adding new fraud detectors and extending the features of the toolbox. Some of the planned features are listed in [TODO list](#todo-list).

Expand All @@ -41,6 +41,7 @@ If you use the toolbox in your project, please cite the [paper](https://arxiv.or
```

**Useful Resources**
- [UGFraud: An Unsupervised Graph-based Toolbox for Fraud Detection](https://github.com/safe-graph/UGFraud)
- [Graph-based Fraud Detection Paper List](https://github.com/safe-graph/graph-fraud-detection-papers)
- [Awesome Fraud Detection Papers](https://github.com/benedekrozemberczki/awesome-fraud-detection-papers)
- [Attack and Defense Papers on Graph Data](https://github.com/safe-graph/graph-adversarial-learning-literature)
Expand Down Expand Up @@ -71,7 +72,7 @@ python setup.py install
* tensorflow>=1.14.0,<2.0
* numpy>=1.16.4
* scipy>=1.2.0
networkx<=1.11
* networkx<=1.11
```
## Datasets

Expand Down Expand Up @@ -144,7 +145,7 @@ The repository is organized as follows:
| **GEM** | [Heterogeneous Graph Neural Networks for Malicious Account Detection](https://arxiv.org/pdf/2002.12307.pdf) | CIKM 2018 |[BibTex](https://github.com/safe-graph/DGFraud/blob/master/reference/gem.txt) |
| **GraphSAGE** | [Inductive Representation Learning on Large Graphs](https://arxiv.org/pdf/1706.02216.pdf) | NIPS 2017 | [BibTex](https://github.com/safe-graph/DGFraud/blob/master/reference/graphsage.txt) |
| **GraphConsis** | [Alleviating the Inconsistency Problem of Applying Graph Neural Network to Fraud Detection](https://arxiv.org/pdf/2005.00625.pdf) | SIGIR 2020 | [BibTex](https://github.com/safe-graph/DGFraud/blob/master/reference/graphconsis.txt) |
<!--| **HACUD** | [Cash-Out User Detection Based on Attributed Heterogeneous Information Network with a Hierarchical Attention Mechanism](https://aaai.org/ojs/index.php/AAAI/article/view/3884) | AAAI 2019 | Bibtex |-->
| **HACUD** | [Cash-Out User Detection Based on Attributed Heterogeneous Information Network with a Hierarchical Attention Mechanism](https://aaai.org/ojs/index.php/AAAI/article/view/3884) | AAAI 2019 | [BibTex](https://github.com/safe-graph/DGFraud/blob/master/reference/hacud.txt) |


## Model Comparison
Expand All @@ -158,7 +159,7 @@ The repository is organized as follows:
| **GEM** | Financial Fraud | Heterogeneous |GCN |
| **GraphSAGE** | Opinion Fraud | Homogeneous | GraphSAGE |
| **GraphConsis** | Opinion Fraud | Heterogeneous | GraphSAGE |
<!--| **HACUD** | | | |-->
| **HACUD** | Financial Fraud | Heterogeneous | GAT |


## TODO List
Expand All @@ -170,8 +171,8 @@ The repository is organized as follows:
- Benchmarking SOTA models
- Scalable implementation
- TensorFlow 2.0+ implementation
- Pytorch version
- Pytorch implementation

## How to Contribute
You are welcomed to contribute to this open-source toolbox. The detailed instructions will be released soon. Currently, you can create issues or send email to [ytongdou@gmail.com](mailto:ytongdou@gmail.com) for inquiry.
You are welcomed to contribute to this open-source toolbox. The detailed instructions will be released soon. Currently, you can create issues or send email to [bdscsafegraph@gmail.com](mailto:bdscsafegraph@gmail.com) for inquiry.

5 changes: 5 additions & 0 deletions algorithms/GraphConsis/neigh_samplers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Zhiwei Liu (@JimLiu96) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
from __future__ import division
from __future__ import print_function

Expand Down
5 changes: 5 additions & 0 deletions algorithms/GraphConsis/supervised_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Zhiwei Liu (@JimLiu96) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import tensorflow as tf
import models as models
import layers as layers
Expand Down
18 changes: 16 additions & 2 deletions algorithms/GraphSage/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Description
# GraphSAGE

## Paper
The GraphSAGE model is proposed by the [paper](http://papers.nips.cc/paper/6703-inductive-representation-learning-on-large-graphs.pdf) below:
```bibtex
@inproceedings{hamilton2017inductive,
title={Inductive representation learning on large graphs},
author={Hamilton, Will and Ying, Zhitao and Leskovec, Jure},
booktitle={Advances in neural information processing systems},
pages={1024--1034},
year={2017}
}
```

# Brief Introduction
We revise the original code of [graphsage](https://github.com/williamleif/GraphSAGE/tree/master/graphsage) so that it can load our data format and train the model.

# Run the code
Expand All @@ -10,4 +24,4 @@ line 28 in `utils.py` file
```python
rownetworks = [data['net_rur']]
```
- Before running the code, please remember unzip the given dataset.
- Before running the code, please remember unzip the given YelpChi dataset.
2 changes: 1 addition & 1 deletion algorithms/HACUD/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

The HACUD model is proposed by the [paper](https://aaai.org/ojs/index.php/AAAI/article/view/3884) below:

```
```bibtex
@inproceedings{DBLP:conf/aaai/HuZSZLQ19,
author = {Binbin Hu and
Zhiqiang Zhang and
Expand Down
5 changes: 5 additions & 0 deletions algorithms/HACUD/data_loader.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Hengrui Zhang (@hengruizhang98) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import numpy as np
from sklearn.model_selection import train_test_split
import scipy.io as sio
Expand Down
5 changes: 5 additions & 0 deletions algorithms/HACUD/get_data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Hengrui Zhang (@hengruizhang98) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import numpy as np
import random as rd
import scipy.sparse as sp
Expand Down
5 changes: 5 additions & 0 deletions algorithms/HACUD/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Hengrui Zhang (@hengruizhang98) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import numpy as np
import pandas as pd
import os
Expand Down
5 changes: 5 additions & 0 deletions algorithms/HACUD/model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Hengrui Zhang (@hengruizhang98) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import tensorflow as tf
import os
import sys
Expand Down
5 changes: 5 additions & 0 deletions algorithms/HACUD/parse.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Hengrui Zhang (@hengruizhang98) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import argparse

def parse_args():
Expand Down
5 changes: 5 additions & 0 deletions algorithms/HACUD/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
'''
This code is due to Hengrui Zhang (@hengruizhang98) and UIC BDSC Lab
DGFraud (A Deep Graph-based Toolbox for Fraud Detection)
https://github.com/safe-graph/DGFraud
'''
import random
import scipy.io as sio
import scipy.sparse as sp
Expand Down
12 changes: 12 additions & 0 deletions reference/hacud.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@inproceedings{DBLP:conf/aaai/HuZSZLQ19,
author = {Binbin Hu and
Zhiqiang Zhang and
Chuan Shi and
Jun Zhou and
Xiaolong Li and
Yuan Qi},
title = {Cash-Out User Detection Based on Attributed Heterogeneous Information
Network with a Hierarchical Attention Mechanism},
booktitle = {The Thirty-Third AAAI Conference on Artificial Intelligence},
year = {2019}
}
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
requirements = f.read().splitlines()

setup(name='DGFraud',
author="Yutong Deng, Yingtong Dou and UIC BDSC Lab",
author_email="ytongdou@gmail.com",
description='a GNN based toolbox for fraud detection in Tensorflow',
version="0.1.0",
author="Yutong Deng, Yingtong Dou, Hengrui Zhang, and UIC BDSC Lab",
author_email="bdscsafegraph@gmail.com",
description='a GNN-based toolbox for fraud detection in Tensorflow',
long_description=open("README.md", "r", encoding="utf-8").read(),
long_description_content_type="text/markdown",
url='https://github.com/safe-graph/DGFraud',
Expand All @@ -24,13 +25,14 @@
install_requires=['numpy>=1.16.4',
'tensorflow>=1.14.0,<2.0',
'scipy>=1.2.1',
'scikit_learn>=0.21rc2'
'scikit_learn>=0.21rc2',
'networkx<=1.11'
],
packages=find_packages(exclude=['test']),
include_package_data=True,
setup_requires=['setuptools>=38.6.0'],
classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
'Intended Audience :: Education',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Science/Research',
Expand Down

0 comments on commit 3e502bf

Please # to comment.