Skip to content

Customer segmentation using RFM + K-Means clustering. 5 segments identified, ₹1.36 Cr revenue opportunity, 3.59:1 ROI. Python | ML | Marketing Analytics

Notifications You must be signed in to change notification settings

priyanka7411/customer-segmentation-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Customer Segmentation & Marketing Analytics

A complete customer segmentation solution using RFM Analysis and K-Means clustering to identify 5 actionable customer segments and generate ₹1.36 Crore revenue opportunity through targeted marketing strategies.

Business Problem

Company: ShopEase Online Retail
Challenge: Treating all 4,970 customers the same, wasting 60% of marketing budget
Current State: No personalization, high acquisition costs (₹5,000/customer), unknown customer value
Goal: Segment customers and create targeted strategies to maximize ROI

Solution Overview

Built a data-driven customer segmentation system that:

  • Segments 4,970 customers into 5 actionable groups using RFM + K-Means
  • Calculates Customer Lifetime Value (CLV) for prioritization
  • Identifies ₹1.36 Crore revenue opportunity (3.59:1 ROI)
  • Provides specific marketing strategies for each segment

Key Findings

5 Customer Segments Identified

Segment Customers Avg CLV Total Revenue Characteristics
Champions 877 (17.6%) ₹1,326 ₹11.63L Recent, frequent, high spenders - VIP treatment
Loyal Customers 1,301 (26.2%) ₹796 ₹10.36L Consistent buyers - cross-sell opportunities
Big Spenders 541 (10.9%) ₹744 ₹4.03L High value but infrequent - increase frequency
Need Attention 818 (16.5%) ₹432 ₹3.53L At risk of churning - win-back campaigns
Lost/Hibernating 1,433 (28.8%) ₹274 ₹3.92L Inactive customers - reactivation needed

Critical Insights

  1. Top 2 segments generate 58% of revenue (Champions + Loyal)
  2. 1,433 customers are inactive = ₹3.92L at stake
  3. Average CLV: ₹673 across all customers
  4. Total CLV potential: ₹33.5 Lakhs if retention improves

Financial Impact & ROI

Marketing Investment & Returns

Segment Investment Expected Return Net Gain ROI
Champions ₹17.54L ₹87.70L ₹70.16L 5:1
Loyal Customers ₹13.01L ₹52.04L ₹39.03L 4:1
Big Spenders ₹8.12L ₹24.34L ₹16.23L 3:1
Need Attention ₹6.54L ₹13.09L ₹6.54L 2:1
Lost/Hibernating ₹7.17L ₹10.75L ₹3.58L 1.5:1
TOTAL ₹52.37L ₹187.92L ₹135.55L 3.59:1

Bottom Line: Invest ₹52 Lakhs → Generate ₹1.36 Crore net gain

Technical Solution

Methodology

  1. RFM Analysis

    • Recency: Days since last purchase
    • Frequency: Number of purchases
    • Monetary: Total amount spent
    • Scored each metric 1-5 (5 = best)
  2. K-Means Clustering

    • Used Elbow Method to find optimal K=5
    • Standardized features for equal weighting
    • Created distinct, actionable segments
  3. Customer Lifetime Value (CLV)

    • Formula: Avg Order Value × Purchase Frequency × Lifespan
    • Estimated lifespan based on recency patterns
    • Calculated total CLV: ₹33.5 Lakhs
  4. Marketing Strategy Development

    • Segment-specific action plans
    • ROI projections per strategy
    • Implementation timeline

Project Structure

customer-segmentation-analysis/
├── data/
│   ├── raw/                    # Transaction data (25,000 records)
│   └── processed/              # RFM scores, segments, CLV
├── notebooks/
│   └── 01_rfm_analysis_and_segmentation.ipynb
├── sql/
│   └── customer_segmentation_queries.sql
├── reports/
│   ├── elbow_method.png
│   └── customer_segments_visualization.png
└── README.md

Marketing Strategies by Segment

Champions (₹70.16L net gain potential)

Goal: Retain and maximize value
Actions:

  • VIP Program with exclusive access
  • Loyalty rewards with premium benefits
  • Referral incentives (₹500/referral)
  • Early sale access
  • Dedicated account manager

Investment: ₹2,000/customer/year | ROI: 5:1

Loyal Customers (₹39.03L net gain)

Goal: Increase frequency and value
Actions:

  • Cross-sell campaigns
  • Volume discounts (10% off >₹1000)
  • Birthday rewards
  • Loyalty points program
  • Quarterly exclusive offers

Investment: ₹1,000/customer/year | ROI: 4:1

Big Spenders (₹16.23L net gain)

Goal: Increase purchase frequency
Actions:

  • Buy 2 get 1 free promotions
  • Subscription model (15% discount)
  • Product bundles
  • Replenishment reminders
  • Free shipping + gift wrapping

Investment: ₹1,500/customer/year | ROI: 3:1

Need Attention (₹6.54L net gain)

Goal: Prevent churn
Actions:

  • 20% win-back discount
  • Feedback surveys
  • Personalized recommendations
  • 48-hour urgency deals
  • Free shipping

Investment: ₹800/customer/year | ROI: 2:1

Lost/Hibernating (₹3.58L net gain)

Goal: Reactivate dormant customers
Actions:

  • 30% comeback offer
  • "What's new" campaigns
  • Personal phone calls (high-value)
  • Zero barriers (₹0 minimum, free returns)
  • Category-specific offers

Investment: ₹500/customer/year | ROI: 1.5:1

Tools & Technologies

  • Python 3.11: Data processing and ML
  • Pandas & NumPy: Data manipulation
  • Scikit-learn: K-Means clustering, StandardScaler
  • Matplotlib & Seaborn: Visualizations
  • Jupyter Notebook: Analysis documentation
  • SQL: Customer segment extraction

Key Deliverables

  1. RFM Analysis: 4,970 customers scored and ranked
  2. Customer Segments: 5 distinct, actionable groups
  3. CLV Calculations: Lifetime value for each customer
  4. Marketing Strategies: Detailed plans with ROI per segment
  5. SQL Queries: 12 production-ready queries
  6. Visualizations: Elbow method, 3D segment view, revenue analysis

Implementation Timeline

  • Month 1-2: Launch Champions & Loyal programs (highest ROI)
  • Month 3-4: Implement Big Spenders frequency campaigns
  • Month 5-6: Deploy Need Attention retention efforts
  • Month 7-12: Ongoing Lost customer reactivation

Success Metrics

  1. Segment migration (customers moving up/down)
  2. Purchase frequency increase per segment
  3. Average order value growth
  4. Customer retention rate (especially Champions)
  5. Reactivation rate for Lost segment
  6. Campaign ROI vs projections

How to Run This Project

1. Setup

git clone https://github.com/priyanka7411/customer-segmentation-analysis.git
cd customer-segmentation-analysis
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

2. Run Analysis

jupyter notebook
# Open notebooks/01_rfm_analysis_and_segmentation.ipynb

3. Execute SQL Queries

Load sql/customer_segmentation_queries.sql into your database

Business Impact Summary

Current State:

  • 4,970 customers
  • ₹27.56 Lakhs total revenue
  • No segmentation or targeting
  • Wasting marketing budget

After Implementation:

  • 5 clear customer segments
  • ₹1.36 Crore additional revenue potential
  • 3.59:1 marketing ROI
  • Personalized strategies per segment
  • Data-driven decision making

Author

Priyanka Malavade
BCA Graduate | GUVI Certified Data Scientist (2025)

Portfolio Projects

  1. E-Commerce Sales Analysis - Revenue analysis, $1.5M opportunity
  2. HR Attrition Prediction - ML model, ₹1.35 Cr savings
  3. Customer Segmentation (This Project) - ₹1.36 Cr revenue opportunity

License

This project is for educational and portfolio purposes.


Note: All financial figures in Indian Rupees (₹). Lakhs (L) = 100,000 | Crore (Cr) = 10,000,000

About

Customer segmentation using RFM + K-Means clustering. 5 segments identified, ₹1.36 Cr revenue opportunity, 3.59:1 ROI. Python | ML | Marketing Analytics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published