Skip to content

estasz/GNN-QGNN-FraudDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Introduction

This project, by Erik Staszewski under the supervision of David Redmond for Equal1, seeks to implement and extend quantum computing techniques for credit card fraud detection. The primary objective is to construct and compare the performance of a classical Graph Neural Network (GNN) with a Quantum Graph Neural Network (QGNN) for binary classification of fraudulent and non-fraudulent credit card transactions.

Currently, the quantum components are being simulated using NVIDIA CUDA backends, hence the slower operation time. Once Equal1's new quantum hardware is released, these quantum operations will run with performance times comparable to, or exceeding, their classical counterparts, enabling real-time quantum-enhanced machine learning with improved results.

Performance is evaluated using precision, recall, and $F_1$-scores, and plotted using Receiver Operating Characteristic (ROC) and Precision-Recall (PR) Curves.

Model Architecture

GNN Model

  • The GNN model consists of 3 GraphSAGE or GCN convolutional layers, each followed by batch normalization, and a GeLU actiation.
  • A dense layer maps the final embeddings to a single scalar output, followed by a sigmoid activation for fraud classification.
  • The GNN model is trained for 100 epochs, optimized with Adam, has BCELoss as the loss function, a weight-decay of $1e^{-4}$, and a learning rate of 0.01.

QGNN Model

  • The QGNN model consists of a single SGConv layer, followed by ReLU actication.
  • A single-qubit quantum layer is used, implementing RX and RY gates, followed by a dense layer, and a sigmoid activation for fraud classification.
  • The QGNN BCELoss model is trained for 220 epochs, optimized using Adam, has BCELoss as the loss function, a weight decay of $1e^{-4}$, and a learning rate of 0.01.
  • The QGNN FocalLoss model is trained for 280 epochs, optimized using Adam, has FocalLoss as the loss function with any Alpha value and a Gamma value of 5.5, and a learning rate of 0.01

Results

The results are shown below. As shown below, the QGNN BCELoss model outperforms both GNN models in all metrics, and the QGNN FocalLoss model outperforms the QGNN BCELoss model in three metrics.

Metric GNN QGNN
GraphSAGE GCN SGConv
BCELoss BCELoss FocalLoss
Precision Score 86.45% 86.27% 86.62% 87.25%
Recall Score 82.21% 80.98% 83.44% 79.75%
$F_1$ Score 84.28% 83.54% 85.00% 83.33%
ROC AUC 95.65% 96.59% 96.79% 97.91%
PR AUC 78.68% 74.90% 80.80% 80.98%

Note

Best results are shown in bold.

How to Run

This project includes both a classical Graph Neural Network (GNN) and a hybrid Quantum Graph Neural Network (QGNN) for credit card fraud detection. The QGNN uses a simulated quantum circuit based on NVIDIA's CUDA-Q framework.

Hardware Requirements

System Requirements

  • OS: Linux
  • Python 3.9, 3.10, or 3.11 (for CUDA-Q simulation)
  • NVIDIA GPU with CUDA support (for CUDA-Q simulation)

Code Preparation

Clone the Repository:

git clone https://github.com/estasz/GNN-QGNN-FraudDetection.git
cd GNN-QGNN-FraudDetection

Open the file:

jupyter notebook GNN-QGNN.ipynb

And run the model. Feel free to add your own dataset.

License

This repository is licensed under the Apache 2.0 License. The source code is free to use, modify, and distribute under the terms of this license. Use of the trained models may be subject to additional terms as defined by Equal1.

Releases

No releases published

Packages

 
 
 

Contributors