Skip to content

k-siddhartha-ai/Product_Category_Prediction_Decision_Tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

🛍️ Product Category Prediction using Decision Tree

👨‍💻 Author: Karne Siddhartha — Python Developer | AI / NLP Developer

A machine learning web application that predicts the product category based on product attributes such as price, weight, and customer rating.

This project demonstrates an end-to-end supervised machine learning workflow including model training, evaluation, explainability, and real-time prediction through an interactive Streamlit application.


🚀 Live Demo (Hugging Face)

👉 https://huggingface.co/spaces/Siddhartha001/Product_Category_Prediction_Decision_Tree


🧠 Model Overview

Algorithm: Decision Tree Classifier Problem Type: Multi-class Classification Goal: Learn interpretable decision rules for product categorization.

Input Features

  • Price
  • Weight (kg)
  • Customer Rating

Output

  • Predicted Product Category
  • Prediction Confidence Score
  • Decision Tree Visualization (Explainable AI)

Supported Categories

  • Electronics
  • Clothing
  • Grocery

📊 Dataset

A small demonstration dataset is used to highlight model interpretability and decision boundaries clearly.

Price Weight (kg) Rating Category
1000 1.5 4.5 Electronics
50 0.5 3.8 Clothing
10 0.3 4.8 Grocery

📌 The dataset is intentionally compact so users can visually understand how decision trees split features and make predictions.


⚙️ How the Application Works

  1. Data is loaded and split into training and testing sets.
  2. Features are used to train a Decision Tree Classifier.
  3. Model performance is evaluated using accuracy metrics.
  4. Users provide new product details through the UI.
  5. The model predicts the category with confidence probability.
  6. A visual tree diagram explains the decision path.

🛠 Tech Stack

  • Python
  • Streamlit
  • Scikit-learn
  • NumPy
  • Pandas
  • Matplotlib

📁 Project Structure

Product_Category_Prediction/
├── app.py                 # Streamlit ML application
├── requirements.txt       # Dependencies
└── README.md              # Project documentation

▶️ Run Locally

pip install -r requirements.txt
streamlit run app.py

🎯 Project Highlights

  • Explainable Machine Learning using Decision Trees
  • Interactive real-time prediction interface
  • Visual interpretation of model logic
  • Clean end-to-end ML pipeline structure
  • Beginner-friendly yet industry-relevant design

👤 Author

Karne Siddhartha Python Developer | AI & Machine Learning

🤗 Hugging Face: https://huggingface.co/Siddhartha001 🔗 GitHub: https://github.com/k-siddhartha-ai


📌 Notes

  • The dataset is simplified for educational visualization.
  • The architecture can be scaled to real e-commerce datasets.
  • The focus of this project is interpretability, visualization, and ML fundamentals.

Releases

No releases published

Packages

 
 
 

Contributors

Languages