Credit card fraud detection using Scikit-Learn and Snap ML. This README provides an overview of a machine learning model designed to detect credit card fraud using Python and Snap ML. The model utilizes supervised learning techniques and is implemented using the snapml
library for efficient training and inference.
Before running the code, ensure you have the required libraries installed. You can install them using pip:
!pip install snapml
The dataset used for training and evaluation is available at the following URL: Credit Card Fraud Dataset
- Import Libraries: Install necessary packages and import required libraries.
- Data Preprocessing: Read the dataset, inflate it to replicate actual size, and perform data normalization.
- Train/Test Split: Split the dataset into training and testing sets.
- Build Decision Tree Classifier (DTC): Train a DTC model using both Scikit-Learn and Snap ML, compare training times and ROC-AUC scores.
- Build Support Vector Machine (SVM): Train a SVM model using both Scikit-Learn and Snap ML, compare training times and ROC-AUC scores.
- Model Evaluation: Evaluate the quality of SVM models using the hinge loss metric.
-
Decision Tree Classifier (DTC):
- Snap ML vs. Scikit-Learn speedup: 7.62x
- Scikit-Learn ROC-AUC score: 0.966
- Snap ML ROC-AUC score: 0.966
-
Support Vector Machine (SVM):
- Snap ML vs. Scikit-Learn speedup: 4.68x
- Scikit-Learn ROC-AUC score: 0.984
- Snap ML ROC-AUC score: 0.985
- Hinge Loss (Snap ML): 0.228
- Hinge Loss (Scikit-Learn): 0.234
The Snap ML library demonstrates significant speedup in training time compared to Scikit-Learn while maintaining comparable model performance metrics, making it a valuable tool for large-scale machine learning tasks.Snap ML leverages advanced parallel processing capabilities, making use of multi-core CPUs and other optimizations to significantly accelerate the training process.