Skip to content

Sapphirine/202412-9-Fraud-Detection-Using-TabNet-and-Graph-Neural-Networks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

| Transaction Fraud Detection with GNNs

Implementation of Graph Neural Networks for fraud detection on the Elliptic Bitcoin and IEEE-CIS datasets.

Project Structure

transaction_fraud_detection_with_gnns_tabnet/
├── src/
│   ├── cis_gnn/               # IEEE-CIS implementation
│   │   ├── data/
│   │   ├── graph_utils.py
│   │   ├── model.py
│   │   ├── process_data.py
│   │   ├── train.py
│   │   └── utils.py
│   │
│   |── elliptic_gnn/         # Elliptic Bitcoin implementation
│   |   ├── datasets.py
│   |   ├── models.py
│   |   ├── trainer.py
│   |   └── main.py
│   └── tabnet/               # TabNet implementation
|        ├── data_processor.py     
|        ├── models.py            
|        ├── trainer.py          
|        ├── main.py            
├── README.md
└── requirements.txt
└── app.py # Used for website

Setup

  1. Install requirements:
pip install -r requirements.txt

As I was using CUDA 12.4, For DGL compatibility, I had to install the following:

pip install  dgl -f https://data.dgl.ai/wheels/torch-2.4/cu124/repo.html
  1. Download Elliptic Dataset:
pip3 install kaggle
kaggle datasets download -d ellipticco/elliptic-data-set
unzip elliptic-data-set.zip -d src/elliptic_gnn/data/
  1. Download IEEE-CIS Dataset:
kaggle competitions download -c ieee-fraud-detection
unzip ieee-fraud-detection.zip
mkdir -p src/cis_gnn/data/ieee_cis
mv *.csv src/cis_gnn/data/ieee_cis/

Usage

Elliptic Bitcoin Dataset

cd src/elliptic_gnn
python main.py --model-type gat --epochs 100

IEEE-CIS Dataset

cd src/cis_gnn
python process_data.py
python train.py

Capital One Dataset

cd src/tabnet
python main.py

Website

python app.py

This works on port 5000

Models

  • GAT (Graph Attention Network)
  • GCN (Graph Convolutional Network)
  • GIN (Graph Isomorphism Network)

For detailed implementation and parameters, refer to respective source files.

Results

Elliptic Bitcoin Dataset

Model Accuracy F1-Macro Precision Recall
GAT 0.994 0.983 0.979 0.960
GCN 0.976 0.925 0.939 0.739
GIN 0.981 0.947 0.931 0.879

IEEE-CIS Dataset

Metric Value
F1 Score 0.0665
Precision 0.0344
Recall 1.0000
Accuracy 0.0344
ROC AUC 0.9125
PR AUC 0.5781
Average Precision 0.5781

Capital One Synthetic Dataset

Metric Value
F1 Score (True) 0.07
F1 Score (False) 0.85
Precision (False) 0.99
Precision (True) 0.04
Recall (False) 0.75
Recall (True) 0.67
Accuracy 0.75
Macro Avg F1 Score 0.46
Weighted Avg F1 Score 0.84
ROC AUC Score 0.7824

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published