{"id":34670887,"url":"https://github.com/ricardorobledo/paymentcardfrauddetection2025","last_synced_at":"2026-04-14T06:02:09.335Z","repository":{"id":312110597,"uuid":"1046353328","full_name":"RicardoRobledo/PaymentCardFraudDetection2025","owner":"RicardoRobledo","description":"Comparative analysis of probabilistic classification models for credit card fraud detection, focusing on model calibration and threshold optimization in highly imbalanced datasets.","archived":false,"fork":false,"pushed_at":"2025-08-28T15:08:43.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-28T22:24:24.028Z","etag":null,"topics":["imbalanced-learn","matplotlib","numpy","pandas","python3","scikit-learn","search"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RicardoRobledo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-28T15:03:15.000Z","updated_at":"2025-08-28T15:10:46.000Z","dependencies_parsed_at":"2025-08-28T22:25:16.059Z","dependency_job_id":"3d326332-c4bd-4a3f-b649-21dbf294d474","html_url":"https://github.com/RicardoRobledo/PaymentCardFraudDetection2025","commit_stats":null,"previous_names":["ricardorobledo/paymentcardfrauddetection2025"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/RicardoRobledo/PaymentCardFraudDetection2025","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRobledo%2FPaymentCardFraudDetection2025","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRobledo%2FPaymentCardFraudDetection2025/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRobledo%2FPaymentCardFraudDetection2025/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRobledo%2FPaymentCardFraudDetection2025/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RicardoRobledo","download_url":"https://codeload.github.com/RicardoRobledo/PaymentCardFraudDetection2025/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RicardoRobledo%2FPaymentCardFraudDetection2025/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31784255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imbalanced-learn","matplotlib","numpy","pandas","python3","scikit-learn","search"],"created_at":"2025-12-24T19:56:15.100Z","updated_at":"2026-04-14T06:02:09.330Z","avatar_url":"https://github.com/RicardoRobledo.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧾 Probabilistic Models \u0026 Fraud Detection Analysis\n\n## 📌 About the Project\nThis project focuses on the **comparison and calibration of probabilistic classification models**, applied to a **credit card fraud detection dataset**. The main goal is to evaluate **which models generate the most reliable and calibrated probability estimates**, especially in a **highly imbalanced dataset** where fraud detection is critical.\n\n## 📊 Dataset Information\n- **Name:** [Card Fraud Detection in Luxury Retail Analytics Dataset](https://www.kaggle.com/datasets/pratyushpuri/payment-card-fraud-detection-with-ml-models-2025/data)\n- **Records:** 2,133 transactions\n- **Features:** 16 (transactional + behavioral attributes)\n- **Context:** Luxury cosmetics pop-up events across major global cities\n- **Objective:** Identify fraudulent credit card transactions\n\nAlthough synthetic, the dataset was carefully designed to mimic realistic **fraud patterns**, making it ideal for research in **fraud analytics**.\n\n## ⚙️ Methodology\n\n### 1. Preprocessing\n- Separation of numeric and categorical features\n- Missing value imputation\n- Standardization of continuous variables\n- One-Hot Encoding for categorical variables\n\n### 2. Probabilistic Models Compared\n- 🎯 **Support Vector Classifier (SVC)** with isotonic calibration\n- 📈 **Logistic Regression (LR)**\n- 📊 **Linear Discriminant Analysis (LDA)**\n- 🌲 **Random Forest (RF)**\n- 🔥 **Gradient Boosting (GB)**\n- 🧮 **Naive Bayes (NB)**\n\n### 3. Imbalanced Learning Techniques\n**Undersampling:**\n- Tomek Links\n- ENN\n- OSS\n- NCR\n- RENN\n\n**Oversampling:**\n- RandomOverSampler\n- SMOTE\n- BorderlineSMOTE\n- ADASYN\n\n### 4. Evaluation Metrics\n- **Brier Score Loss (BS):** Quality of predicted probabilities\n- **Brier Skill Score (BSS):** Relative improvement vs. trivial baseline\n- **Confusion Matrices** and **ROC Curve** at different thresholds\n- **Youden's Index (J = Sensitivity + Specificity – 1)** for optimal threshold tuning\n\n## 📈 Key Results\n\n### 🏆 Model Performance (Brier Skill Score)\n| Model | BSS Score | Rank |\n|-------|-----------|------|\n| **SVC (calibrated)** | ~0.646 | 🥇 **Best** |\n| Random Forest | ~0.638 | 🥈 |\n| Logistic Regression | ~0.634 | 🥉 |\n| LDA | ~0.624 | 4th |\n| Gradient Boosting | ~0.599 | 5th |\n| Naive Bayes | Very poor | Last |\n\n### 🔄 Resampling Techniques Impact\n- **One-Sided Selection (OSS)** showed the best improvement (~0.603)\n- Oversampling methods (SMOTE, ADASYN) did **not** significantly improve performance\n\n### ⚖️ Threshold Optimization Results\n- **Default threshold (0.5):** Almost no fraud cases detected\n- **Optimal threshold (~0.034):** Better fraud detection, but increased false positives\n- **Key insight:** Threshold optimization is essential in imbalanced problems\n\n## 📊 Visualizations\n\n### Confusion Matrices Analysis\n- **At default threshold (0.5):** Almost all predictions classified as \"non-fraud\"\n- **At optimal threshold (0.034):** Better fraud detection with trade-off in false alarms\n\n### ROC Curve Analysis\n- ROC curve with optimal Youden's point highlighted\n- Clear visualization of sensitivity vs. specificity trade-offs\n\n## 🎯 Main Conclusions\n\n1. **Probability calibration matters** — Success isn't just about classification accuracy, but also about generating trustworthy probability estimates\n\n2. **Best combination:** SVC with isotonic calibration + OSS undersampling provided the most balanced results\n\n3. **Threshold tuning is critical:** Using Youden's Index for threshold optimization is essential in fraud detection scenarios\n\n4. **Visual analysis value:** ROC curves and confusion matrices help stakeholders understand trade-offs between sensitivity and specificity\n\n## 🚀 Technical Implications\n\nThis analysis demonstrates that:\n- Model sophistication doesn't always translate to better probability estimates in imbalanced scenarios\n- Proper calibration can significantly improve model reliability\n- Undersampling techniques may outperform oversampling in certain fraud detection contexts\n- Threshold optimization is crucial for practical deployment in fraud detection systems\n\n## 📁 Repository Structure\n```\n├── data/                   # Dataset files\n├── notebooks/              # Jupyter notebooks with analysis\n├── src/                    # Source code for models and preprocessing\n├── results/                # Generated plots and evaluation metrics\n└── README.md              # This file\n```\n\n## 🔧 Dependencies\n- Python 3.8+\n- scikit-learn\n- pandas\n- numpy\n- matplotlib\n- seaborn\n- imbalanced-learn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardorobledo%2Fpaymentcardfrauddetection2025","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricardorobledo%2Fpaymentcardfrauddetection2025","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardorobledo%2Fpaymentcardfrauddetection2025/lists"}