This repository contains a comprehensive credit card fraud detection project that utilizes both classical and quantum machine learning techniques. The project aims to identify fraudulent transactions using various machine learning models, including a Variational Quantum Classifier (VQC) to explore the potential of quantum computing in fraud detection.
- Introduction
- Dataset
- Classical Machine Learning Models
- Quantum Machine Learning Model
- Results
- Installation
- Usage
Credit card fraud detection is a critical application of machine learning in financial services. With an increasing amount of transactions, detecting fraudulent activity efficiently and accurately is vital. This project explores various classical machine learning techniques and introduces a quantum machine learning approach to enhance fraud detection.
The dataset used for this project is the Credit Card Fraud Detection dataset from Kaggle. It contains anonymized credit card transactions with features related to transactions and labels indicating whether each transaction is fraudulent or not.
We implemented and evaluated several classical machine learning models to compare their performance in detecting fraudulent transactions. The following models were tested:
- Logistic Regression: A baseline model used to assess the feasibility of fraud detection.
- MLP Classifier: A neural network model used for more complex patterns.
- Support Vector Classifier (SVC): A model that finds the hyperplane that best separates the classes.
- Random Forest Classifier: An ensemble method that combines multiple decision trees.
In addition to classical models, we explored a quantum machine learning approach using a Variational Quantum Classifier (VQC). Quantum Machine Learning leverages quantum computing's potential to handle complex data structures and potentially improve prediction accuracy.
The VQC is a hybrid quantum-classical algorithm that optimizes a quantum circuit's parameters to classify data. It involves:
- Quantum Data Encoding: Encoding classical data into quantum states.
- Quantum Circuit Design: Creating a parameterized quantum circuit.
- Training: Using a classical optimizer to find the best parameters for the quantum circuit.
- Classification: Applying the trained quantum circuit to classify new data.
The performance of the models was evaluated using accuracy, precision, recall, and F1-score metrics. The VQC demonstrated competitive performance compared to classical models, indicating that quantum approaches are a promising area for future research.
To set up the project, you need to install the required libraries. Use the following command:
pip install numpy pandas matplotlib scikit-learn qiskit qiskit-machine-learning qiskit_algorithms
-
Clone the repository:
git clone https://github.com/rishn/QML-Fraud-Detection.git
-
Navigate to the project directory:
cd QML-Fraud-Detection
-
Extract the dataset from the zip file
creditcard.zip
. -
Open the Jupyter Notebook:
jupyter notebook
-
Run the notebook cells to execute the project code.