{"id":25811446,"url":"https://github.com/dvarshith/transaction-fraud-detection","last_synced_at":"2025-02-28T00:40:09.179Z","repository":{"id":277099112,"uuid":"931329668","full_name":"dvarshith/transaction-fraud-detection","owner":"dvarshith","description":"Machine Learning pipeline for financial transaction fraud detection. Incorporates SMOTE, ensemble models, neural networks.","archived":false,"fork":false,"pushed_at":"2025-02-12T05:21:54.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T06:30:20.228Z","etag":null,"topics":["arizona-state-university","autoencoder","catboost","data-mining","ensemble-learning","financial-security","fraud-detection","imbalanced-learning","kaggle","lightbgm","machine-learning","neural-networks","python","smote","xgboost"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvarshith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2025-02-12T05:01:55.000Z","updated_at":"2025-02-12T05:21:58.000Z","dependencies_parsed_at":"2025-02-12T06:40:33.483Z","dependency_job_id":null,"html_url":"https://github.com/dvarshith/transaction-fraud-detection","commit_stats":null,"previous_names":["dvarshith/transaction-fraud-detection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvarshith%2Ftransaction-fraud-detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvarshith%2Ftransaction-fraud-detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvarshith%2Ftransaction-fraud-detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvarshith%2Ftransaction-fraud-detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvarshith","download_url":"https://codeload.github.com/dvarshith/transaction-fraud-detection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241079659,"owners_count":19906104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["arizona-state-university","autoencoder","catboost","data-mining","ensemble-learning","financial-security","fraud-detection","imbalanced-learning","kaggle","lightbgm","machine-learning","neural-networks","python","smote","xgboost"],"created_at":"2025-02-28T00:40:08.638Z","updated_at":"2025-02-28T00:40:09.167Z","avatar_url":"https://github.com/dvarshith.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transaction Fraud Detection\n\n[![Python 3.8+](https://img.shields.io/badge/Python-3.8%2B-blue.svg)](https://www.python.org/)\n[![Machine Learning](https://img.shields.io/badge/Machine%20Learning-Sklearn%2C%20XGBoost%2C%20LGBM-green)](https://scikit-learn.org/)\n[![License](https://img.shields.io/badge/License-YourChoice-blue.svg)](LICENSE)\n\n\u003cbr/\u003e\n\n## Overview\n\nThis repository contains a **fraud detection** pipeline for financial transactions, leveraging **data preprocessing**, **feature engineering**, **class imbalance handling (SMOTE)**, and a **diverse set of machine learning models** (Logistic Regression, Random Forest, LightGBM, CatBoost, XGBoost, and ensemble methods). \n\n**Highlights**:\n- **Novel feature engineering** (time-based features, transaction amount bucketing, etc.)\n- **Handling imbalanced data** via SMOTE\n- **Boosting algorithms** (LightGBM, XGBoost, CatBoost) for high-dimensional data\n- **Advanced neural network approach** with a supervised AutoEncoder for anomaly detection\n- **Stacking and voting ensembles** for robust, high AUC-ROC performance\n\nOur best model (LightGBM) achieved **AUC-ROC of 0.89** on the Vesta Corporation dataset.\n\n\u003cbr/\u003e\n\n## Data\n\nWe use the **Vesta Corporation dataset** (part of a Kaggle competition) (https://www.kaggle.com/competitions/ieee-fraud-detection/overview) which includes:\n- **Transaction data** (TransactionID, card info, transaction amount, time, etc.)\n- **Identity data** (Device info, etc.)\n\n**Due to size and privacy concerns,** the real dataset is **not** included in this repo.\n\n**Key columns**:\n- `TransactionID`\n- `isFraud` (target)\n- `TransactionDT`, `TransactionAmt`\n- `Category features` (ProductCD, card1, card2, etc.)\n- `Identity features` (DeviceType, DeviceInfo)\n \n\u003cbr/\u003e\n\n## Methodology\n1. **Data Preprocessing**  \n   - Missing value imputation  \n   - High-correlation feature removal (via correlation heatmap)  \n   - Encoding categorical features (one-hot or label encoding)\n2. **Feature Engineering**  \n   - **Transaction amount bucketing** (micro, small, etc.)  \n   - **Time-based features** (day-of-week, hour-of-day)  \n   - **Email domain grouping** (e.g., major providers vs. niche)\n3. **Handling Class Imbalance**  \n   - **SMOTE** (Synthetic Minority Oversampling Technique) to oversample the minority (fraud) class.\n4. **Model Training**  \n   - **Logistic Regression**, **Random Forest** (baselines)  \n   - **LightGBM**, **CatBoost**, **XGBoost** (boosting methods)  \n   - Hyperparameter tuning via Bayesian Optimization  \n   - AUC-ROC as primary metric\n5. **Ensemble Methods**  \n   - **Voting** (soft voting across LGBM, CatBoost, XGB, etc.)  \n   - **Stacking** with a meta-learner\n6. **AutoEncoder** (Optional Neural Approach)  \n   - A supervised autoencoder that outputs fraud probability (or uses reconstruction error).\n\n\u003cbr/\u003e\n\n## Results\n```\n|------------------|----------|\n| Model            | AUC-ROC  |\n|------------------|----------|\n| Logistic Reg     |   0.80   |\n| Random Forest    |   0.855  |\n| LightGBM         | **0.89** |\n| CatBoost         |   0.881  |\n| XGBoost          |   0.874  |\n| Voting Ensembles |   0.86   |\n| Stacking         |   0.88   |\n| AutoEncoder      |   0.86   |\n|------------------|----------|\n```\n**LightGBM** emerges as the top performer with **0.89** AUC-ROC, balancing speed and accuracy on this high-dimensional dataset. \n\n\u003cbr/\u003e\n\n## Usage\n1. **Clone the repo**:\n   ```\n   git clone https://github.com/YourUser/transaction-fraud-detection.git\n   cd transaction-fraud-detection\n   ```\n2. **Set up environment**:\n   ```\n   conda create -n fraud python=3.8\n   conda activate fraud\n   pip install -r requirements.txt\n   ```\n   (Create a requirements.txt if you like.)\n3. **Jupyter Notebook**:\n   ```\n   jupyter notebook notebooks/main.ipynb\n   ```\n   Adjust paths as needed to point to your dataset.\n\n\u003cbr/\u003e\n\n## Next Steps\n- Explore other techniques for class imbalance (e.g., ADASYN, cost-sensitive learning).\n- Investigate deeper neural network architectures or specialized anomaly detection methods.\n- Implement real-time streaming pipelines (Spark Streaming, Kafka) for transaction-level fraud detection.\n\n\u003c/br\u003e\n\n## Acknowledgments\n- Dataset by Vesta Corporation [https://www.kaggle.com/competitions/ieee-fraud-detection/overview].\n- Project under Dr. Yanjie Fu, Arizona State University.\n\n \u003c/br\u003e\n\n## License\nThis project is released under the `MIT License`. That means you’re free to use, modify, and distribute the code, but you do so at your own risk.\n\n \u003c/br\u003e\n\n## Contact\nAuthor: Varshith Dupati \u003c/br\u003e\nGitHub: @dvarshith \u003c/br\u003e\nEmail: dvarshith942@gmail.com \u003c/br\u003e\nIssues: Please open an issue on this repo if you have questions or find bugs. \u003c/br\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvarshith%2Ftransaction-fraud-detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvarshith%2Ftransaction-fraud-detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvarshith%2Ftransaction-fraud-detection/lists"}