whatisgithub

What is fraud-detection-kenya?

ammonbelyon/fraud-detection-kenya — explained in plain English

Analysis updated 2026-05-18

0PythonAudience · dataComplexity · 3/5LicenseSetup · easy

In one sentence

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.

Mindmap

mindmap
  root((repo))
    What it does
      Generates synthetic fraud data
      Trains fraud classifiers
      Explains predictions with SHAP
    Tech stack
      Python
      XGBoost and LightGBM
      Streamlit
      SMOTE
    Use cases
      Detect velocity fraud
      Flag account takeover
      Catch tax underreporting
    Audience
      Data analysts
      ML learners
      Fintech researchers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Generate a synthetic dataset of Kenyan M-Pesa, bank, and tax transactions for practicing fraud detection.

USE CASE 2

Train XGBoost and LightGBM models on imbalanced fraud data using SMOTE to balance the classes.

USE CASE 3

Use the Streamlit demo to scan transactions and view a risk gauge with flagged results.

USE CASE 4

Study the SHAP explainability output to see which features drove a fraud prediction.

What is it built with?

PythonXGBoostLightGBMSMOTESHAPStreamlit

How does it compare?

ammonbelyon/fraud-detection-kenya0xhassaan/nn-from-scratch3ks/embedoc
Stars00
LanguagePythonPythonPython
Last pushed2023-06-08
MaintenanceDormant
Setup difficultyeasymoderatehard
Complexity3/54/51/5
Audiencedatadeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 30min

Requires running the data generation and training scripts before the Streamlit demo has a model to load.

MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.

So what is it?

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.

Copy-paste prompts

Prompt 1
Walk me through what each of the three scripts in this repo does, in the order they should be run.
Prompt 2
Explain how the ratio_to_avg_amount and velocity_score features described in this repo's README are calculated.
Prompt 3
Using this repo's fraud type table, describe how I'd add a new rule for detecting structuring transactions.
Prompt 4
Show me how to deploy the Streamlit app from this repo to Streamlit Cloud, based on the README's deploy steps.

Frequently asked questions

What is fraud-detection-kenya?

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.

What language is fraud-detection-kenya written in?

Mainly Python. The stack also includes Python, XGBoost, LightGBM.

What license does fraud-detection-kenya use?

MIT license: free to use, modify, and distribute, including commercially, as long as the copyright notice is kept.

How hard is fraud-detection-kenya to set up?

Setup difficulty is rated easy, with roughly 30min to a first successful run.

Who is fraud-detection-kenya for?

Mainly data.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.