Downloads · 30 days
0
samuelb98/bike-sales-profit-model
bike-sales-profit-model is a machine learning model from samuelb98. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Dec 11, 2025
Repo size
11.5 MB
Likes
0
Public
Click a slice to open those files.
.pkl11.5 MB · 79%
From the Hugging Face model README
🚲 Bike Sales Profit Prediction
🎥 Project Video Presentation : https://www.loom.com/share/01d0945ce32c43e1b765cf901f92e325
📦 Project Overview
This project focuses on predicting delivery days and classifying delivery speed for e-commerce orders using a cleaned and engineered dataset. The project includes two main tasks:
Regression: Predicting the exact number of delivery days.
Classification: Categorizing deliveries into Fast, Medium, or Slow groups.
📊 The Dataset
Source: Olist Brazilian E-Commerce Public Dataset (after preprocessing).
Size: ~100,000 rows after cleaning.
Target Variables:
delivery_days (Regression)
delivery_class (Classification: 0 = Fast, 1 = Medium, 2 = Slow)
Key Features Used
customer_state – destination state (logistics relevance)
product_weight_g – product weight
freight_value – shipping cost
price – product price
cluster_label – group assigned via K-Means clustering
🛠️ Feature Engineering & Cleaning
To improve model performance, several steps were applied:
Removed negative or unrealistic delivery values.
Removed extreme outliers in profit and delivery_days using IQR.




Applied One-Hot Encoding to the customer_state column.
Created 4 clusters based on weight, price, and freight cost.
Added the cluster label as a new feature for both tasks.
🤖 Model Performance Part 1: Regres

sion — Predicting Delivery Days
We compared several regression models on engineered features.
| Model | R2 Score | Notes |
|---|---|---|
| Baseline Linear Regression | ~0.05 | Very low performance |
| Improved Linear Regression | ~0.21 | Better after feature engineering |
| Gradient Boosting (Winner) | 0.267 | Best performance |
Insight: Feature engineering (especially clustering + location encoding) clearly improved predictive accuracy. ==========
🧠 Classification Performance (Fast / Medium / Slow)
To classify delivery speed into Fast, Medium, and Slow, three different classification models were trained:
Logistic Regression
Random Forest Classifier
Gradient Boosting Classifier
Each model was evaluated using Accuracy and F1-macro, ensuring a balanced view of performance across all three classes.
| Model | Accuracy | F1-macro |
|---|---|---|
| Logistic Regression | 0.996 | 0.996 |
| Random Forest | 1.000 | 1.000 |
| Gradient Boosting | 1.000 | 1.000 |
🏆 Best Model
The Random Forest Classifier achieved perfect performance across all evaluation metrics and was selected as the final winning model.
It was exported and uploaded as:winning_classifier.pkl
📁 Repository Structure
This repository contains:
Assignment_2.ipynb — full notebook with EDA, preprocessing, modeling, and evaluation.
winning_model.pkl — trained Gradient Boosting regression model.
winning_classifier.pkl — trained XGBoost classification model.
README.md — project documentation (this file).