Customer Segmentation using Decision Tree (ID3) on Online Retail Dataset
Experiment
Title
Customer Segmentation using Decision Tree (ID3) on Online Retail Dataset
๐ฏ Objective
- To segment customers based on purchasing behavior
- To implement Decision Tree using ID3 (entropy)
-
To analyze:
- Tree structure
- Feature importance
๐ Dataset: Online Retail
Typical features:
-
Quantity→ Number of items purchased -
UnitPrice→ Price per item -
Country→ Customer location -
InvoiceDate→ Purchase date -
CustomerID
๐ฏ Target (Segmentation Idea)
We create a simple segmentation:
๐ High Value Customer (1)
๐ Low Value Customer (0)
Based on:
⚙️ Steps
- Load dataset
- Clean data
- Create features
- Define target
- Train ID3 model
- Visualize tree
- Analyze feature importance
๐ป Python Program
๐ Results
๐น Tree Structure
- Root node often = Total spending related feature (Quantity / UnitPrice)
- Splits based on purchasing patterns
๐น Feature Importance
๐ณ Interpretation of Tree
Example Logic:
๐ Analysis
๐น How Tree Helps Understand Customer Behavior
1. Spending Patterns
- High quantity → bulk buyers
- High price → premium buyers
2. Customer Segmentation
- Low spenders
- High spenders
3. Business Insights
| Pattern | Insight |
|---|---|
| High Quantity | Wholesale customers |
| High UnitPrice | Premium buyers |
| Country influence | Regional behavior |
๐ Key Insights
-
Decision trees are:
- Interpretable
- Easy to visualize
-
ID3 uses:
- Entropy
- Information gain
⚖️ Advantages
- Easy to explain
- Works well with categorical + numeric data
❌ Limitations
- Overfitting
- Sensitive to noise
๐งช Lab Tasks
Task 1
Change depth:
Task 2
Add more features:
Task 3
Compare with:
Result
- Decision Tree (ID3) effectively segments customers
-
Feature importance reveals:
- Key buying factors
-
Tree structure provides:
- Clear business rules

Comments
Post a Comment