An industrial-grade, full-cycle Software Engineering for Data Science system designed to predict customer churn in E-Commerce platforms. Unlike fragmented notebook experiments, this framework is built as a modular, reproducible, and scalable pipeline integrated with a custom-built MLOps tracking and monitoring engine.
Business Impact & Value Proposition
| Pillar | Operational Description | Target Metric |
|---|---|---|
| High-Precision Screening | Early identification of high-risk churning accounts to enable proactive retention campaigns | F1-Score > 0.85 |
| Behavioral SHAP Insights | Game-theoretic feature attribution identifying exact friction points driving customer drop-off | Actionable Causality |
| Targeted Cost Optimization | Concentrates marketing expenditures and retention vouchers exclusively on high-value at-risk cohorts | ROI Optimization |
| Model Governance | End-to-end data versioning, model registry tracking, automated drift alerts, and health checks | Zero Downtime |
Architectural Pipeline & Data Flow
E-Commerce Dataset
Excel Sheet Ingestion")] subgraph S1 ["📊 STAGE 1: Exploratory Data Analysis"] direction TB B1["📂 Load Raw Data"] B2["🔍 Missing Value Profiling"] B3["📈 Correlation Matrix Analysis"] B4["📊 Distribution & Skewness Checking"] B5["⚠️ Outlier Detection & IQR Bounds"] B1 ==> B2 ==> B3 ==> B4 ==> B5 end subgraph S2 ["🧹 STAGE 2: Data Preprocessing"] direction TB C1["🔧 Clean & Standardize
✓ Remove duplicates & schema anomalies
✓ Standardize categorical naming
✓ Fix datatype inconsistencies"] C2["✅ Quality Validation Gate"] C3["✂️ Stratified Split
80% Train | 20% Test Holdout"] C1 ==> C2 ==> C3 end subgraph S3 ["⚙️ STAGE 3: Zero-Leakage Transformation"] direction LR D1["🎯 TRAIN SET"] D2["🔨 FIT + TRANSFORM
• Median/Mode Imputation
• IQR Outlier Clipping
• Feature Engineering
• Categorical Encoding & Scaling"] D3{{"📦 LEARNED ARTIFACTS
Imputers | Clip Bounds
Encoders | StandardScalers"}} D4["🧪 TEST SET"] D5["🎨 TRANSFORM ONLY
Strict application of learned training parameters"] D1 ==> D2 D2 ==> D3 D3 -.->|"persist"| D2 D4 ==> D5 D3 ==>|"apply"| D5 end subgraph S4 ["🎓 STAGE 4: Multi-Model Training & Balancing"] direction TB E1["⚖️ Class Balancing
SMOTE + Tomek Links Hybrid Sampling"] E2["🤖 Train 6 Model Families
Logistic Regression | SVM | Decision Tree
Random Forest | XGBoost | AdaBoost"] E3["🔍 Automated Tuning
RandomizedSearchCV with Stratified K-Fold"] E4["🏆 Model Champion Selection
Ranked by test F1-Score & ROC-AUC"] E1 ==> E2 ==> E3 ==> E4 end subgraph S5 ["📈 STAGE 5: Evaluation & Explainability"] direction TB F1["📊 Confusion Matrix Diagnostics"] F2["📉 ROC-AUC & Precision-Recall Curves"] F3["🎯 Permutation Feature Importance"] F4["📋 Multi-Model Benchmarking Matrix"] F5["🔬 SHAP Game-Theoretic Attribution"] F1 ==> F2 ==> F3 ==> F4 ==> F5 end subgraph S6 ["📦 STAGE 6: Custom MLOps Integration"] direction TB G1["📝 Experiment Tracker (JSON/YAML Snapshots)"] G2["🗃️ Model Registry & Version Control"] G3["🔖 Data Snapshot Versioning"] G4["👁️ Automated Health & Drift Monitor"] G1 ==> G2 ==> G3 ==> G4 end OUTPUT[("💾 PERSISTED ARTIFACTS
experiments/
registry/
monitoring/")] START ==> INPUT INPUT ==> S1 S1 ==> S2 S2 ==> S3 S3 ==> S4 S4 ==> S5 S5 ==> S6 S6 ==> OUTPUT OUTPUT ==> FINISH
Strict Zero Data Leakage Governance
A core architectural principle enforced throughout this framework is the absolute separation of training statistics from evaluation holdouts.
[!IMPORTANT] Strict Data Governance Rule: All statistical parameters (imputation medians, IQR clipping thresholds, categorical encoding dictionaries, and feature scaling means/variances) are learned strictly on the Training Set. The Test Set is strictly transformed using these pre-fitted parameters without re-computation (
transform()only, neverfit_transform()).
Compute distributions & bounds"] B["2️⃣ TRANSFORM
Clean & normalize training matrices"] A ===>|"learns"| B end PARAMS{{"📦 LEARNED PARAMETERS
• Median / Mode Imputers
• Outlier Clip Bounds (Q1-1.5*IQR, Q3+1.5*IQR)
• Label & One-Hot Encoders
• StandardScaler Mean/Std
• Selected Feature Masks"}} subgraph TEST ["🧪 TEST SET (20%)"] direction TB C["❌ NO FIT ALLOWED
Prevents data leakage"] D["3️⃣ TRANSFORM ONLY
Apply exact training parameters"] C -.->|"blocked"| D end A ===> PARAMS PARAMS ===> D
Key Technical Specifications
- Hybrid Class Balancing (SMOTE + Tomek Links): Combines synthetic minority oversampling (SMOTE) with Tomek link cleaning to remove noisy boundary samples, achieving clear decision boundaries for highly skewed churn distributions.
- Multi-Model Benchmarking: Systematically trains, evaluates, and cross-validates 6 distinct classifier families (
LogisticRegression,SVC,DecisionTreeClassifier,RandomForestClassifier,XGBClassifier,AdaBoostClassifier) usingRandomizedSearchCV. - Custom MLOps Registry & Monitoring: Tracks exact hyperparameter snapshots, Git commit hashes, execution metrics, and serialized model objects inside structured
outputs/registry/directories with automated deployment check scripts. - Model Explainability with SHAP: Computes global and local Shapley Additive exPlanations to visualize feature impact distributions across customer tenure, transaction volume, and satisfaction scores.