Tosa9/customer-segmentation-app
๐๏ธ Customer Segmentation โ K-Means Clustering
Group 9 | TechCrush AI/ML Programme
A deployed machine learning web app that segments mall customers into 5 distinct groups using K-Means clustering, built on the Mall Customer Segmentation dataset from Kaggle.
๐ Live App
Deployed on Streamlit Cloud โ [Add your link here after deployment]
๐ Repository Structure
customer-segmentation-app/
โ
โโโ app.py โ Streamlit web application
โโโ kmeans_primary_model.pkl โ Trained K-Means model (from notebook Section 11)
โโโ scaler_2d.pkl โ Fitted StandardScaler (from notebook Section 11)
โโโ Mall_Customers.csv โ Source dataset (from Kaggle)
โโโ requirements.txt โ Python dependencies for Streamlit Cloud
โโโ README.md โ This file๐ง What the App Does
The app has two tabs:
Tab 1 โ Segment Predictor Enter a customer's Annual Income and Spending Score using sliders. The trained K-Means model instantly classifies them into one of 5 segments with a profile description and a recommended business action.
Tab 2 โ Cluster Visualisations Displays all major plots from the project notebook:
- Hero cluster scatter plot (Income vs Spending Score)
- Elbow method and Silhouette Score (how we chose k=5)
- Per-sample silhouette coefficients
- Cluster size distribution
- Feature box plots per cluster
- Radar chart (multi-feature cluster comparison)
- Segment profile table with business actions
- PCA projection of the extended 4-feature model
- Correlation heatmap (EDA)
๐ท๏ธ The 5 Customer Segments
๐ ๏ธ Local Setup
# Clone the repo
git clone https://github.com/Tosa9/customer-segmentation-app.git
cd customer-segmentation-app
# Install dependencies
pip install -r requirements.txt
# Run the app
streamlit run app.py๐ฆ Generating the Model Files
The .pkl files are generated by running the full project notebook:
- Open
Group_9_Customer_Segmentation_Project.ipynbin Google Colab - Upload
Mall_Customers.csvwhen prompted in Section 0 - Run all cells through to Section 11
- Download
kmeans_primary_model.pklandscaler_2d.pklfrom the Colab file browser - Place them in this repo directory
๐ Dataset
Mall Customer Segmentation Dataset Source: Kaggle โ vjchoudhary7 Records: 200 customers | Features: CustomerID, Gender, Age, Annual Income (k$), Spending Score (1-100)
๐ฌ Tech Stack
- Python 3.10+
- scikit-learn โ KMeans, StandardScaler, PCA, metrics
- Streamlit โ Web app framework
- pandas / numpy โ Data manipulation
- matplotlib / seaborn โ Visualisations
- scipy โ Hierarchical clustering (dendrogram)
- joblib โ Model persistence
Group 9 | TechCrush AI/ML Programme
