Analysis updated 2026-05-18
Generate a synthetic dataset of Kenyan M-Pesa, bank, and tax transactions for practicing fraud detection.
Train XGBoost and LightGBM models on imbalanced fraud data using SMOTE to balance the classes.
Use the Streamlit demo to scan transactions and view a risk gauge with flagged results.
Study the SHAP explainability output to see which features drove a fraud prediction.
| ammonbelyon/fraud-detection-kenya | 0xhassaan/nn-from-scratch | 3ks/embedoc | |
|---|---|---|---|
| Stars | 0 | 0 | — |
| Language | Python | Python | Python |
| Last pushed | — | — | 2023-06-08 |
| Maintenance | — | — | Dormant |
| Setup difficulty | easy | moderate | hard |
| Complexity | 3/5 | 4/5 | 1/5 |
| Audience | data | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires running the data generation and training scripts before the Streamlit demo has a model to load.
This project is a machine learning pipeline that flags likely fraudulent financial transactions using synthetic data modeled on Kenyan financial systems, covering M-Pesa mobile money transfers, bank transactions, and KRA tax filings. It is built as a portfolio project focused on East African fintech and financial inclusion, and it uses fake generated data rather than real customer records. The pipeline works in three steps. First, a script generates a synthetic dataset of about 50,000 transactions using patterns meant to resemble real Kenyan financial behavior, such as M-Pesa transaction habits, KRA tax ID formats, and county level geography. Second, a training script builds a set of engineered features, such as how a transaction's amount compares to a person's usual spending, how many transactions happened in the last hour, whether the transaction happened at night, and whether declared tax income looks far lower than expected. Because actual fraud only makes up a small share of transactions, a technique called SMOTE is used to balance the training data before two models, XGBoost and LightGBM, are trained to classify transactions as fraudulent or not. The project also uses SHAP, a technique for explaining which factors influenced a given prediction. Third, a Streamlit app provides a live demo where transactions can be scanned, showing a risk gauge, a list of flagged transactions, and the ability to export flagged records as a CSV file. The README lists five categories of fraud the system is designed to catch: many rapid small transactions, a single transaction far above someone's usual amount, account takeover attempts involving a new device and location together with a large transfer, underreported income relative to expected tax obligations, and transactions structured just below a reporting threshold. The reported results show very high accuracy scores for both models, though the README notes plainly that this reflects how strongly the synthetic data was designed to signal fraud, and that real world performance would likely differ. Running the project locally requires installing the listed Python dependencies, then running the data generation script, the training script, and finally the Streamlit app in order. It can also be deployed to Streamlit's own hosting service. The project is released under the MIT license.
A portfolio machine learning project that detects fraud in synthetic Kenyan M-Pesa, bank, and tax data using XGBoost and LightGBM, with a live Streamlit demo.
Mainly Python. The stack also includes Python, XGBoost, LightGBM.
MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly data.
This repo across BitVibe Labs
Verify against the repo before relying on details.