Explainable Machine Learning for Mobile Payment Fraud Detection
This repository contains the complete code, generated outputs, and reproducibility manifest for a cost-sensitive, explainable machine-learning pipeline for mobile payment fraud detection. The pipeline compares four classifiers (Logistic Regression, Random Forest, XGBoost, LightGBM) on a realistic synthetic mobile payment dataset from a Central Asian emerging market. The dataset has 150,000 transactions and a fraud rate of 3.47 percent. The market was selected as a proof-of-concept for Central and South Asia.The repository enables full reproduction of every table, figure, and number reported in the study. It also provides a reusable template for researchers and mobile payment operators who wish to apply the pipeline to their own transaction data.What the pipeline doesThe pipeline runs in 24 steps across five stages.Stage 1: data preparation. Steps 1 to 6 load the three source tables, merge them, select 12 real-time features, audit feature availability, preprocess the data, and split it into training (70 percent), validation (10 percent), and test (20 percent) sets. The split is stratified to preserve the 3.47 percent fraud rate.Stage 2: cost derivation. Step 4b derives the false-positive cost and false-negative cost from the dataset and from published Uzbek operational figures. The false-positive cost is USD 0.75. The false-negative cost is USD 21.70. The ratio is 28.93 to 1.Stage 3: model training and threshold optimisation. Steps 7 to 9 train four classifiers, sweep 99 thresholds on the validation set, lock the optimal threshold for each model, and evaluate once on the untouched test set. LightGBM achieves the lowest expected financial cost at USD 14,898.40 per 30,000 transactions, at threshold 0.48.Stage 4: robustness and leakage checks. Steps 10 to 19 run eight checks. These are optimism bias (validation versus test tuning), temporal validation (train 2023, test 2024), cost-ratio sensitivity (10 to 1, 29 to 1, 50 to 1, 100 to 1), fixed versus re-optimised threshold sensitivity, 5-fold cross-validation, single-feature leakage screen, train-validation-test overlap check, and feature-availability audit.Stage 5: explainability and comparison. Steps 13 and 20 to 24 produce the SHAP feature importance for the deployed model, all publication-ready tables and figures, the hyperparameter tuning comparison, the feature engineering comparison, and the final pipeline recommendation.Key findings reproduced by this repositoryThe deployed model is LightGBM at threshold 0.48. Test cost is USD 14,898.40 per 30,000 transactions. Cost at the default threshold of 0.5 is USD 14,941.30. The saving is 0.29 percent. Test AUC-PR is 0.0901. Test F2 is 0.2417. Test MCC is 0.1295. 5-fold cross-validation AUC-PR is 0.0900 plus or minus 0.0055. Temporal validation cost for LightGBM is USD 36,879.95 on 74,918 transactions. The maximum single-feature AUC-PR is 0.0569 from hour_of_day. There is zero overlap between train, validation, and test sets. SHAP analysis shows that login_attempts, risk_score, and hour_of_day are the top three predictors. Transaction amount ranks seventh with a relative importance of 9.3.Files in this repositoryThe repository contains the following files.Notebook and code. The Jupyter notebook or Python script that runs all 24 steps in sequence. The notebook runs end to end in Kaggle with the public dataset attached.Reproducibility manifest. A JSON file recording library versions (Python, numpy, pandas, scikit-learn, xgboost, lightgbm, shap), random seed, split sizes, cost parameters, deployed model name, and deployed threshold.Data outputs. CSV files for every intermediate and final table. These include the merged dataset summary, the feature-availability audit, the cost derivation, the split summary, the validation threshold sweep, the test results, the optimism-bias table, the temporal validation table, the cost-ratio sensitivity table, the fixed versus re-optimised threshold table, the 5-fold cross-validation table, the single-feature leakage table, the train-validation-test overlap table, the SHAP importance table, the tuning comparison table, the feature engineering comparison table, and the final pipeline comparison table.Publication-ready tables. Five tables in CSV and LaTeX format. Table 1 is performance metrics. Table 2 is default versus validation-optimal threshold. Table 3 is SHAP feature importance. Table 4 is cost parameter derivation. Table 5 is robustness and leakage checks summary.Figures. Publication-quality PNG figures. These include the SHAP summary plot, the SHAP bar plot, the validation cost curves per model, the test cost bar chart, the precision-recall curves, the ROC curves, the confusion matrices, the cost-ratio sensitivity heatmap, the model comparison chart, and the per-model threshold panels.Data sourceThe dataset used in this study is publicly available on Kaggle under a CC0 Public Domain license (Safarbek, 2025). The dataset contains synthetic transactions generated to mirror the statistical properties of a Central Asian mobile payment ecosystem. No real personal or financial data is included. The dataset citation is:Safarbek. (2025). Central Asia Fintech Fraud Detection Dataset. Kaggle. https://www.kaggle.com/datasets/safar1/central-asia-fintech-fraud-datasetReproducibilityTo reproduce the results, open the notebook in Kaggle, attach the dataset from Kaggle as input, and run all cells. All outputs will be written to the working directory. The reproducibility manifest records the library versions used in the original run. To reproduce the exact numbers reported in the study, install the same library versions listed in the manifest.Intended useThe repository is intended for researchers and mobile payment operators who wish to develop cost-sensitive fraud detection pipelines. The code is written to be adapted. Users can replace the dataset with their own transaction data and recalibrate the cost parameters to their institution's operational environment. The threshold optimisation and SHAP explainability components are dataset-agnostic.
Authors
- Jerónimo Paiva (ORCID: https://orcid.org/0000-0002-8300-962X)
Publication Details
- Journal
- Figshare
- Published
- 2026-11-24
- DOI
- https://doi.org/10.6084/m9.figshare.35107111
- Primary Topic
- Imbalanced Data Classification Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00