# Machine Learning Model for Detecting Fraudulent Transactions in Nigeria's Digital Banking Sector
Seminar research project. Trains and compares three supervised machine learning
models (Logistic Regression, Random Forest, XGBoost) for fraud detection on the
PaySim synthetic mobile money dataset, following the methodology described in
Chapter Three of the accompanying paper.
## 1. Get the dataset
This repository does not include the dataset (it is ~470MB and hosted on Kaggle
under its own license). To get it:
1. Create a free Kaggle account if you don't have one:
kaggle.com
2. Go to:
kaggle.com
3. Click **Download** and unzip it.
4. Place the CSV file in this repo's `data/` folder and rename it to:
`data/paysim.csv`
Alternatively, using the Kaggle CLI (`pip install kaggle`, after setting up your
`kaggle.json` API token as described at
github.com):
```bash
kaggle datasets download -d ealaxi/paysim1 -p data --unzip
mv data/PS_20174392719_1491204439457_log.csv data/paysim.csv
```
## 2. Set up the environment
```bash
python3 -m venv venv
source venv/bin/activate # on Windows: venv\Scripts\activate
pip install -r requirements.txt
```
## 3. Run the pipeline
```bash
python src/train_evaluate.py
```
This will:
- load and clean `data/paysim.csv`
- engineer additional features
- split the data (stratified) into train/test sets
- apply SMOTE to the training set only
- train Logistic Regression, Random Forest, and XGBoost with grid-searched
hyperparameters
- evaluate all three on the untouched test set using precision, recall,
F1-score, and ROC-AUC
- save a comparison table, ROC curves, and confusion matrices to `outputs/`
Expect this to take anywhere from a few minutes to a while longer depending on
your machine, the dataset has about 6.3 million rows.
## 4. What you'll get in `outputs/`
- `model_comparison.csv` — the precision/recall/F1/ROC-AUC table for all three
models, this is th …