Machine learning framework for analyzing e-commerce customer behavior — Case study: Sawa Citi Supermarket, Rwanda
# A Machine Learning Framework for Analyzing E-Commerce Customer Behavior
### A Case Study of Sawa Citi Supermarket, Rwanda
> Master's Thesis in Computer Science — 2026
---
## Overview
This repository contains the complete thesis project: written chapters (Markdown source) and the Python machine learning pipeline that produces all empirical results for Chapters 4 and 5.
**Case study:** Sawa Citi Supermarket (Brood Rwanda Limited), Kigali, Rwanda
**Data:** POS transaction data from two branches — HQ (March 2026) and Kisimenti (March–May 2026)
**Total records:** 26,533 line items across 16,597 transactions from 2,056 named customers
---
## ML Pipeline Results (Sawa Citi data)
| Track | Algorithm | Key Metric |
|---|---|---|
| A — Customer Segmentation | K-Means (k=3) + RFM | Silhouette = 0.496 |
| B — Purchase-Intent Classification | XGBoost (best) | ROC-AUC = 0.9995, F1 = 0.985 |
| B — Purchase-Intent Classification | Random Forest | ROC-AUC = 0.9988, F1 = 0.966 |
| B — Purchase-Intent Classification | Logistic Regression (baseline) | ROC-AUC = 0.964, F1 = 0.817 |
| C — Product Recommendation | Item-Based CF (cosine similarity) | Precision@10 = 0.026, MAP = 0.062 |
**Customer segments discovered:**
| Segment | Count | Avg Monetary (RWF) | Avg Frequency |
|---|---|---|---|
| Champions | 363 | 101,548 | 4.3 days |
| Potential Loyalists | 80 | 15,609 | 1.6 days |
| At-Risk Customers | 1,613 | 5,298 | 1.1 days |
---
## Repository Structure
```
thesis/
├── overview.md # Project rules
├── README.md
├── .gitignore
├── chapters/ # Thesis writing (Markdown source)
│ ├── 01_introduction.md
│ ├── 02_literature_review.md
│ ├── 03_methodology.md
│ ├── 04_results.md # pending — uses pipeline outputs
│ └── 05_conclusion.md # pending
├── references/
│ └── references.bib # IEEE bibliography (single, end of document)
├── figures/ # Diagrams for the the …