2 min read
Customer Churn Prediction System

Project Summary

Built an end-to-end machine learning pipeline that predicts customer churn 30 days in advance with 87% accuracy. The system automatically triggers retention campaigns for at-risk customers, resulting in a 25% reduction in churn rate.

Technical Implementation

ML Pipeline

  • Feature Engineering: 150+ features from behavioral, transactional, and demographic data
  • Model Selection: XGBoost with hyperparameter tuning via Optuna
  • Deployment: REST API with Flask, containerized with Docker
  • Monitoring: MLflow for experiment tracking and model versioning

Key Features

class ChurnPredictor:
    def __init__(self):
        self.model = self.load_model()
        self.feature_pipeline = FeaturePipeline()
        
    def predict_churn(self, customer_id):
        # Extract features
        features = self.feature_pipeline.extract(customer_id)
        
        # Generate prediction
        churn_probability = self.model.predict_proba(features)[0][1]
        
        # Trigger retention if high risk
        if churn_probability > 0.7:
            self.trigger_retention_campaign(customer_id)
        
        return {
            'customer_id': customer_id,
            'churn_probability': churn_probability,
            'risk_level': self.get_risk_level(churn_probability),
            'recommended_actions': self.get_recommendations(features)
        }

Business Impact

  • Churn Reduction: 25% decrease in monthly churn
  • Revenue Saved: $500K/month in retained customers
  • Campaign Efficiency: 3x improvement in retention campaign ROI
  • Processing Time: Real-time predictions in <100ms