Customer Churn Predictor API
Outcome
Delivered a production-ready churn prediction API and proved an end-to-end ML workflow from data to deployment
Timeline
2 days (prototype → deployment)
Role
AI/ML Engineer
Technologies
Project Overview
The Customer Churn Predictor API is an end-to-end machine learning deployment that predicts customer churn using the Telco Customer Churn dataset. I built and deployed a production-ready model wrapped in a FastAPI microservice and containerized with Docker for portability.
Value: Predict at-risk customers so businesses can prioritize retention actions and measure impact.
Problem & Opportunity
Customer churn is a high-cost problem for subscription-driven businesses. Predicting churn enables targeted retention campaigns and directly improves revenue retention.
This project demonstrates how an ML model can be integrated into standard engineering workflows and delivered as an API that product teams can use.
Dataset & Preparation
- Dataset: Telco Customer Churn (Kaggle).
- Preprocessing: Cleaned missing values, encoded categorical variables, and scaled numeric features.
- Feature focus: demographics, tenure, contract type, and service subscriptions—features aligned with real churn drivers.
Modeling Approach
Baseline & Strategy
I started with Logistic Regression for interpretability, then experimented with tree-based methods. Class imbalance was handled by adjusting class weights and monitoring recall-first metrics to prioritize catching churners.
Evaluation
- Primary metric: Recall (catch churners)
- Secondary: Precision, AUC
- Result: Strong predictive accuracy; top features included contract type, tenure, and monthly charges
Model Management
Models and preprocessing pipelines were serialized with joblib. Experiments were tracked locally (notebooks) and artifacts saved to a `/models` folder for reproducible deployment.
Repository structure: /notebooks, /app, /models
Technical Architecture & Implementation
Key pieces:
- API:
POST /predictaccepts JSON features and returns churn probability. - FastAPI: Lightweight microservice exposing inference endpoints and simple docs.
- Docker: Containerized for consistent deployment across environments.
- Deployment: Deployed on GCP for accessibility during demos.
Design goal: Make the model usable by product teams through a well-documented, low-latency API.
Challenges & Trade-offs
Pipeline Iteration
Iterating preprocessing without breaking inference required careful serialization of the pipeline and versioned artifacts.
Model Selection
Balanced interpretability vs performance; logistic regression was interpretable but tree-based models improved raw performance.
Deployment Portability
Ensuring the API behaved consistently across environments required Docker and careful dependency pinning.
Monitoring
Production monitoring and model drift detection were out-of-scope but identified as necessary next steps.
Outcomes & Learnings
What I Delivered
A working end-to-end ML pipeline, a serialized model, and a FastAPI service ready for integration.
Skills Gained
- Model evaluation and metric-driven development
- API design and integration
- Containerization and deployment practices
Proudest achievement: Demonstrating the ability to not only train models but to ship them as production-ready services.
Future Directions
- Experiment with XGBoost or Random Forests to improve performance.
- Add MLOps practices: CI/CD pipelines, monitoring, and model versioning.
- Extend the service with a dashboard that visualizes churn risk and business impact.
Reflection
This project was my first true AI/ML engineering experience — connecting data science workflows with software engineering practices. The exercise gave me confidence in making ML usable through APIs and shipping reproducible artifacts.
Advice: don't stop at training a model—wrap it in an API, deploy it, and make it usable. That's when ML becomes real.