How hariss402/credit-card-fraud-detection works
1. Purpose and Execution Model
This is an educational, notebook-driven machine-learning experiment for binary credit-card fraud classification under extreme class imbalance. The primary and apparent sole execution entry point is Credit_Card_Fraud_Detection.ipynb; there is no packaged application, service, CLI, deployment artifact, or production inference endpoint.
2. Data Boundary
The workflow consumes the Kaggle Credit Card Fraud Detection dataset, expected under the repository’s data area. Input consists of numerical transaction features—anonymized PCA fields plus Time and Amount—and a binary Class label. The dataset itself is not represented in the supplied tree; its local-data guidance is in data/readme.md. The notebook owns loading, inspection, cleaning, and conversion into model-ready feature/target partitions.
Grounding paths:
• data/
• data/readme.md
• Credit_Card_Fraud_Detection.ipynb
3. Exploratory and Preprocessing Stage
The notebook first performs data exploration and EDA to establish class distribution, feature behavior, correlations, and potential outliers. Preprocessing includes feature scaling and outlier detection/removal. Dimensionality reduction with t-SNE is used for exploratory visualization rather than described as a serving-time feature pipeline.
This boundary is important: preprocessing, exploration, visualization, and modeling are coupled in one stateful notebook rather than exported reusable modules.
Grounding path:
• Credit_Card_Fraud_Detection.ipynb
4. Imbalance-Handling Branches
The central experimental design compares approaches for the minority fraud class: random under-sampling of legitimate transactions and SMOTE synthetic over-sampling. These sampled datasets feed downstream training/evaluation, enabling comparison against the severe native class distribution.
Sampling must conceptually occur within the training workflow to avoid leakage into held-out evaluation; the repository exposes no standalone pipeline enforcing that separation.
Grounding path:
• Credit_Card_Fraud_Detection.ipynb
5. Model Training Layer
The notebook trains several classifier families against the prepared/sampled data:
• Logistic Regression
• K-Nearest Neighbors
• Support Vector Machine
• Decision Tree
• TensorFlow/Keras neural network
Classical estimators are supplied by scikit-learn; the neural-network branch introduces the TensorFlow/Keras runtime. Model comparison is the system’s main output, rather than a selected serialized champion model.
Grounding paths:
• Credit_Card_Fraud_Detection.ipynb
• requirements.txt
6. Evaluation and Decision Outputs
Trained models are evaluated through accuracy, precision, recall, F1, ROC-AUC, confusion matrices, and precision-recall curves. The project explicitly prioritizes fraud-sensitive measures—especially precision, recall, F1, and ROC-AUC—over raw accuracy. Results are notebook visualizations and analysis, with no indicated artifact registry, model persistence, threshold-serving contract, or automated report.
Grounding path:
• Credit_Card_Fraud_Detection.ipynb
7. Runtime and Infrastructure
The runtime is local Python/Jupyter, with notebook dependencies declared in requirements.txt; development-specific dependencies are separated in requirements_dev.txt. Core libraries are Pandas/NumPy for data handling, Matplotlib/Seaborn for visualization, scikit-learn and imbalanced-learn for classical ML/sampling, and TensorFlow/Keras for neural models. Kaggle is the external dataset source. No cloud infrastructure, database, API, scheduler, CI pipeline, or web framework is present.
Grounding paths:
• requirements.txt
• requirements_dev.txt
• Credit_Card_Fraud_Detection.ipynb
Main entry points: Credit_Card_Fraud_Detection.ipynb Load and partition data · data Local data area · requirements.txt Runtime dependencies · requirements_dev.txt Development dependencies
Components 17
Local experiment runtime
Stateful Python/Jupyter workflow.
- Runtime dependencies · ML, visualization, and notebook libraries.
requirements.txt - Development dependencies · Separate development-only dependencies.
requirements_dev.txt - Local Python/Jupyter · Interactive execution environment.
Notebook experiment
Exploration, preprocessing, training, and analysis are coupled.
- Fraud detection notebook · Sole experiment entry point.
Credit_Card_Fraud_Detection.ipynb - Load and partition data · Creates model-ready features, target, and held-out evaluation data.
Credit_Card_Fraud_Detection.ipynb - EDA and visualization · Inspects class imbalance, correlations, features, and outliers.
Credit_Card_Fraud_Detection.ipynb - Scale and clean features · Applies scaling and outlier handling.
Credit_Card_Fraud_Detection.ipynb - t-SNE visualization · Dimensionality reduction for visualization, not serving features.
Credit_Card_Fraud_Detection.ipynb - Random undersampling · Reduces legitimate-class training examples.
Credit_Card_Fraud_Detection.ipynb - SMOTE oversampling · Synthesizes minority-class training examples.
Credit_Card_Fraud_Detection.ipynb - Fraud-focused evaluation · Computes precision, recall, F1, ROC-AUC, accuracy, and confusion matrices.
Credit_Card_Fraud_Detection.ipynb - Comparison plots and analysis · Notebook-only model comparison; no persisted champion model.
Credit_Card_Fraud_Detection.ipynb
Model branches
Classifier families compared in the notebook.
- Classical classifiers · Logistic regression, KNN, SVM, and decision tree.
Credit_Card_Fraud_Detection.ipynb - Keras neural network · Neural classifier branch.
Credit_Card_Fraud_Detection.ipynb
Other components
- Kaggle fraud dataset · Credit-card transactions with numerical features and Class label.
- Local data area · Expected local location for the downloaded dataset.
data - Data setup guidance · Explains local dataset placement.
data/readme.md
Connections 20
- Kaggle fraud dataset → Local data area: downloaded locally
- Data setup guidance → Local data area: documents setup
- Runtime dependencies → Local Python/Jupyter: installs runtime
- Development dependencies → Local Python/Jupyter: adds dev tooling
- Local Python/Jupyter → Fraud detection notebook: executes
- Local data area → Load and partition data: transaction data
- Fraud detection notebook → Load and partition data: loads
- Load and partition data → EDA and visualization: inspect data
- Load and partition data → Scale and clean features: features and target
- Scale and clean features → t-SNE visualization: visualize structure
- Scale and clean features → Random undersampling: training data
- Scale and clean features → SMOTE oversampling: training data
- Random undersampling → Classical classifiers: sampled training set
- SMOTE oversampling → Classical classifiers: sampled training set
- Random undersampling → Keras neural network: sampled training set
- SMOTE oversampling → Keras neural network: sampled training set
- Classical classifiers → Fraud-focused evaluation: predictions
- Keras neural network → Fraud-focused evaluation: predictions
- Load and partition data → Fraud-focused evaluation: held-out evaluation data
- Fraud-focused evaluation → Comparison plots and analysis: metrics and plots