Author: Ashley Prado
Dataset: product_sales.csv
This project analyzes supermarket product performance using machine learning techniques. It includes:
- ✨ Full data preprocessing (missing values, outliers, normalization)
- ✨ K-means clustering fully implemented from scratch
- ✨ Regression modeling (Linear & Polynomial Regression)
- ✨ Visualizations for non-technical users
- ✨ A complete analytical write-up in
REPORT.pdf
Ensure Python 3.8+ is installed.
Install dependencies:
pip install pandas numpy matplotlib scikit-learn
Or with conda:
conda install pandas numpy matplotlib scikit-learn
Handles missing values, outliers, and standardization.
python source_code/preprocessing.py
Runs K-means for k = 2–8 and prints WCSS for the elbow method.
python source_code/kmeans_from_scratch.py
Generates cluster statistics and saves results in the results/ folder.
python source_code/cluster_analysis.py
Creates the elbow curve and cluster scatter plot.
python source_code/visualization.py
Trains Linear & Polynomial Regression and saves evaluation plots.
python source_code/regression.py
- 🎯 Optimal cluster count: 4
- 🔮 Best performing regression model: Polynomial Regression (degree 2)
- 📉 Model Performance:
- Linear Regression MAE ≈ 67.97
- Polynomial Regression MAE ≈ 1.04
A full analytical explanation of preprocessing, clustering, regression, and interpretation is provided in:
REPORT.pdf