How shivammitra/customer-churn-model works
Purpose and execution model
This is a lightweight, notebook-driven customer churn-risk classification demo. The sole implementation entry point is Churn Probability (Random Forest ) Model.ipynb; it runs the full workflow interactively, from dataset acquisition through evaluation and an example prediction. There is no packaged service, CLI, or deployed inference endpoint.
Data acquisition boundary
The notebook obtains the Telco Customer Churn dataset through the external IBM Skills Network skillsnetwork helper rather than a versioned dataset stored in the repository. The model target is categorical CHURNRISK with Low, Medium, and High classes. This external download is the principal reproducibility and availability boundary.
• Churn Probability (Random Forest ) Model.ipynb
Exploration and feature preparation
The notebook first profiles the raw tabular data, audits missingness, and inspects churn-class distribution. It then separates numerical and categorical features into preprocessing paths:
• numerical columns: imputation followed by standard scaling;
• categorical columns: imputation followed by one-hot encoding.
This creates model-ready feature matrices while preserving a consistent transformation process for training and single-record scoring.
• Churn Probability (Random Forest ) Model.ipynb
Dataset partitioning
Prepared data is split 80/20 into training and test sets with stratification on churn risk. Stratification is the key control that preserves class representation between fit and evaluation datasets, especially for the three-level target.
• Churn Probability (Random Forest ) Model.ipynb
Model training
The central model is scikit-learn’s RandomForestClassifier, configured with 100 trees and random_state=42. The forest is the baseline predictive component and consumes the transformed mixed-type tabular features. The fixed seed supports repeatable model behavior given stable source data and library versions.
• Churn Probability (Random Forest ) Model.ipynb
Evaluation and interpretation
The test-set prediction flow produces overall accuracy and a full per-class precision, recall, and F1 classification report. The notebook additionally renders feature importance, providing a model-level interpretation layer; reported prominent drivers include trading-value, income, login-recency, and gains features.
• Churn Probability (Random Forest ) Model.ipynb
Persistence and inference demonstration
The notebook includes a placeholder joblib persistence step for serializing the trained random forest, but it must be enabled to create a reusable artifact. A final single-customer prediction demonstration represents the inference path. For production use, the fitted preprocessing state and model should be persisted and loaded together; otherwise one-hot feature alignment and scaling can diverge from training.
• Churn Probability (Random Forest ) Model.ipynb
Main entry points: Churn Probability (Random Forest ) Model.ipynb Random forest
Components 13
Interactive Notebook
The sole implementation and execution entry point.
- Telco churn data · Contains the three-class CHURNRISK target.
Churn Probability (Random Forest ) Model.ipynb - Data profiling · Audits schema, missingness, and class distribution.
Churn Probability (Random Forest ) Model.ipynb - Feature routing · Separates numerical and categorical columns.
Churn Probability (Random Forest ) Model.ipynb - Numeric pipeline · Imputes then standard-scales numerical features.
Churn Probability (Random Forest ) Model.ipynb - Categorical pipeline · Imputes then one-hot encodes categorical features.
Churn Probability (Random Forest ) Model.ipynb - Model-ready features · Combined transformed mixed-type features.
Churn Probability (Random Forest ) Model.ipynb - 80/20 stratified split · Preserves Low, Medium, and High class representation.
Churn Probability (Random Forest ) Model.ipynb - Random forest · 100 trees with random_state=42.
Churn Probability (Random Forest ) Model.ipynb - Test evaluation · Computes accuracy and per-class precision, recall, and F1.
Churn Probability (Random Forest ) Model.ipynb - Feature importance · Shows model-level driver importance.
Churn Probability (Random Forest ) Model.ipynb - Single-customer scoring · Applies the workflow to one customer record.
Churn Probability (Random Forest ) Model.ipynb - Optional joblib artifact · Placeholder persistence step that must be enabled.
Churn Probability (Random Forest ) Model.ipynb
Other components
- IBM Skills Network · Downloads the Telco Customer Churn dataset.
Connections 13
- IBM Skills Network → Telco churn data: downloads
- Telco churn data → Data profiling: profiles
- Telco churn data → Feature routing: routes features
- Feature routing → Numeric pipeline: numerical columns
- Feature routing → Categorical pipeline: categorical columns
- Numeric pipeline → Model-ready features: transforms
- Categorical pipeline → Model-ready features: encodes
- Model-ready features → 80/20 stratified split: splits with target
- 80/20 stratified split → Random forest: training set
- Random forest → Test evaluation: test predictions
- Random forest → Feature importance: importance scores
- Random forest → Single-customer scoring: predicts risk
- Random forest → Optional joblib artifact: optional serialization