👨💻 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.
👉 https://huggingface.co/spaces/Siddhartha001/Product_Category_Prediction_Decision_Tree
Algorithm: Decision Tree Classifier Problem Type: Multi-class Classification Goal: Learn interpretable decision rules for product categorization.
- Price
- Weight (kg)
- Customer Rating
- Predicted Product Category
- Prediction Confidence Score
- Decision Tree Visualization (Explainable AI)
- Electronics
- Clothing
- Grocery
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.
- Data is loaded and split into training and testing sets.
- Features are used to train a Decision Tree Classifier.
- Model performance is evaluated using accuracy metrics.
- Users provide new product details through the UI.
- The model predicts the category with confidence probability.
- A visual tree diagram explains the decision path.
- Python
- Streamlit
- Scikit-learn
- NumPy
- Pandas
- Matplotlib
Product_Category_Prediction/
├── app.py # Streamlit ML application
├── requirements.txt # Dependencies
└── README.md # Project documentation
pip install -r requirements.txt
streamlit run app.py- 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
Karne Siddhartha Python Developer | AI & Machine Learning
🤗 Hugging Face: https://huggingface.co/Siddhartha001 🔗 GitHub: https://github.com/k-siddhartha-ai
- 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.