Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/safe-graph/ugfraud

An Unsupervised Graph-based Toolbox for Fraud Detection
https://github.com/safe-graph/ugfraud

anomaly-detection data-science fraud-detection fraud-prevention graph-algorithms machine-learning opensource outlier-detection security-tools spam-detection toolbox

Last synced: 2 days ago
JSON representation

An Unsupervised Graph-based Toolbox for Fraud Detection

Awesome Lists containing this project

README

        












Building


GitHub


Downloads


Pypi version


An Unsupervised Graph-based Toolbox for Fraud Detection

**Introduction:**
UGFraud is an unsupervised graph-based fraud detection toolbox that integrates several state-of-the-art graph-based fraud detection algorithms. It can be applied to bipartite graphs (e.g., user-product graph), and it can estimate the suspiciousness of both nodes and edges. The implemented models can be found [here](#implemented-models).

The toolbox incorporates the Markov Random Field (MRF)-based algorithm, dense-block detection-based algorithm, and SVD-based algorithm. For MRF-based algorithms, the users only need the graph structure and the prior suspicious score of the nodes as the input. For other algorithms, the graph structure is the only input.

Meanwhile, we have a [deep graph-based fraud detection toolbox](https://github.com/safe-graph/DGFraud) which implements state-of-the-art graph neural network-based fraud detectors.

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).

If you use the toolbox in your project, please cite the [paper](https://arxiv.org/abs/2006.06069) below and the [algorithms](#implemented-models) you used :
```bibtex
@inproceedings{dou2020robust,
title={Robust Spammer Detection by Nash Reinforcement Learning},
author={Dou, Yingtong and Ma, Guixiang and Yu, Philip S and Xie, Sihong},
booktitle={Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery \& Data Mining},
year={2020}
}
```

**Useful Resources**
- [PyGOD: A Python Library for Graph Outlier Detection (Anomaly Detection)](https://github.com/pygod-team/pygod)
- [DGFraud: A Deep Graph-based Fraud Detection Toolbox](https://github.com/safe-graph/DGFraud)
- [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)
- [PyOD: A Python Toolbox for Scalable Outlier Detection (Anomaly Detection)](https://github.com/yzhao062/pyod)
- [PyODD: An End-to-end Outlier Detection System](https://github.com/datamllab/pyodds)
- [DGL: Deep Graph Library](https://github.com/dmlc/dgl)
- [Outlier Detection DataSets (ODDS)](http://odds.cs.stonybrook.edu/)

**Table of Contents**
- [Installation](#installation)
- [User Guide](#user-guide)
- [Implemented Models](#implemented-models)
- [Model Comparison](#model-comparison)
- [TODO List](#todo-list)
- [How to Contribute](#how-to-contribute)

## Installation
You can install UGFraud from `pypi`:

```bash
pip install UGFraud
```

or download and install from `github`:

```bash
git clone https://github.com/safe-graph/UGFraud.git
cd UGFraud
python setup.py install
```

### Dataset
The demo data is not the intact data (`rating` and `date` information are missing). The rating information is only used in ZooBP demo. If you need the intact date to play demo, please email [[email protected]](mailto:[email protected]) to download the intact data from [Yelp Spam Review Dataset](http://odds.cs.stonybrook.edu/yelpchi-dataset/). The `metadata.gz` file in `/UGFraud/Yelp_Data/YelpChi` includes:
- `user_id`: 38063 number of users
- `product_id`: 201 number of products
- `rating`: from 1.0 (low) to 5.0 (high)
- `label`: -1 is not spam, 1 is spam
- `date`: data creation time

## User Guide

### Running the example code
You can find the implemented models in `/UGFraud/Demo/` directory. For example, you can run fBox using:
```bash
python eval_fBox.py
```

### Running on your datasets
Check out the `data_to_network_graph` function in `/UGFraud/Demo/demo_pre.py` to convert your data into the [networkx](https://networkx.github.io/documentation/stable/tutorial.html#creating-a-graph) graph.

In order to use your own data, you have to provide the following information at least:
* a dict of dict:
```
'user_id':{
'product_id':
{
'label': 1
}
```
* a dict of prior

You can use `dict_to networkx(graph_dict)` function from `/Utils/helper.py` file to convert your graph_dict into a networkx graph.
For more details, please see `data_to_network_graph.py`.

### The structure of code
The `/UGFraud` repository is organized as follows:
- `Demo/` contains the implemented models and the corresponding example code;
- `Detector/` contains the basic models;
- `Yelp_Data/` contains the necessary dataset files;
- `Utils/` contains the every help functions.

## Implemented Models

| Model | Paper | Venue | Reference |
|-------|--------|--------|--------|
| **SpEagle** | [Collective Opinion Spam Detection: Bridging Review Networks and Metadata](https://www.andrew.cmu.edu/user/lakoglu/pubs/15-kdd-collectiveopinionspam.pdf) | KDD 2015 | [BibTex](https://github.com/safe-graph/UGFraud/blob/master/reference/speagle.txt) |
| **GANG** | [GANG: Detecting Fraudulent Users in Online Social Networks via Guilt-by-Association on Directed Graph](https://ieeexplore.ieee.org/document/8215519) | ICDM 2017 | [BibTex](https://github.com/safe-graph/UGFraud/blob/master/reference/gang.txt)|
| **fBox** | [Spotting Suspicious Link Behavior with fBox: An Adversarial Perspective](https://arxiv.org/pdf/1410.3915.pdf) | ICDM 2014 | [BibTex](https://github.com/safe-graph/UGFraud/blob/master/reference/fbox.txt) |
| **Fraudar** | [FRAUDAR: Bounding Graph Fraud in the Face of Camouflage](https://bhooi.github.io/papers/fraudar_kdd16.pdf) | KDD 2016 | [BibTex](https://github.com/safe-graph/UGFraud/blob/master/reference/fraudar.txt) |
| **ZooBP** | [ZooBP: Belief Propagation for Heterogeneous Networks](http://www.vldb.org/pvldb/vol10/p625-eswaran.pdf) | VLDB 2017 | [BibTex](https://github.com/safe-graph/UGFraud/blob/master/reference/zoobp.txt) |
| **SVD** | [Singular value decomposition and least squares solutions](https://link.springer.com/content/pdf/10.1007/978-3-662-39778-7_10.pdf) | - |[BibTex](https://github.com/safe-graph/UGFraud/blob/master/reference/svd.txt) |
| **Prior** | Evaluating suspicioueness based on prior information | - | - |

## Model Comparison
| Model | Application | Graph Type | Model Type |
|-------|--------|--------|-------|
| **SpEagle** | Review Spam | Tripartite | MRF |
| **GANG** | Social Sybil | Bipartite | MRF |
| **fBox** | Social Fraudster | Bipartite | SVD |
| **Fraudar** | Social Fraudster | Bipartite | Dense-block |
| **ZooBP** | E-commerce Fraud | Tripartite | MRF |
| **SVD** | Dimension Reduction | Bipartite | SVD |

## TODO List
- Homogeneous graph implementation

## How to Contribute
You are welcomed to contribute to this open-source toolbox. Currently, you can create issues or send email to [[email protected]](mailto:[email protected]) for inquiry.