Sam212000 commited on
Commit
2d44533
·
verified ·
1 Parent(s): a57bd48

Update model card

Browse files
Files changed (1) hide show
  1. README.md +109 -227
README.md CHANGED
@@ -17,316 +17,198 @@ metrics:
17
  model_name: Telecom Churn Prediction Model
18
  ---
19
 
20
- # Model Card for Telecom Churn Prediction Model
 
 
 
21
 
22
- This model predicts whether high-value telecom customers are likely to churn (cancel their service) based on their usage patterns over a 3-month period.
23
 
24
  ## Model Details
25
 
26
  ### Model Description
27
 
28
- This is an ensemble of scikit-learn classifiers trained to predict customer churn in the telecom industry. The model focuses specifically on high-value customers (top 70th percentile by recharge amount) and uses behavioral data from months 6, 7, and 8 to predict churn in month 9.
 
29
 
30
- - **Developed by:** MLOps Pipeline Team
31
- - **Shared by:** Sam2120
32
- - **Model type:** Binary classification ensemble (Logistic Regression, Random Forest, Gradient Boosting)
 
33
  - **Language(s) (NLP):** en
34
  - **License:** mit
35
- - **Finetuned from model:** Not applicable - trained from scratch
 
 
36
 
37
- ### Model Sources
38
 
39
- - **Repository:** https://github.com/Sam2120/telecom-churn-mlops
40
- - **Paper:** Not applicable
41
- - **Demo:** Hugging Face Spaces integration available
42
 
43
  ## Uses
44
 
 
 
45
  ### Direct Use
46
 
47
- This model is designed for:
48
- - **Customer retention teams** to identify at-risk high-value customers
49
- - **Marketing teams** to target retention campaigns
50
- - **Business analysts** to understand churn patterns and drivers
51
- - **Real-time churn risk scoring** via the provided FastAPI endpoint
52
 
53
- The model accepts tabular customer data with features like call usage, recharge history, and internet usage, and outputs a churn probability (0-1) and binary prediction.
54
 
55
- ### Downstream Use
56
 
57
- - **Integration with CRM systems** for automated retention workflows
58
- - **Customer lifetime value (CLV) modeling** by combining churn predictions with revenue data
59
- - **Campaign optimization** to prioritize high-risk, high-value customers
60
- - **Fraud detection** for identifying unusual usage patterns
61
 
62
  ### Out-of-Scope Use
63
 
64
- This model should NOT be used for:
65
- - **Predicting churn for low-value customers** (model trained only on high-value segment)
66
- - **Long-term churn prediction** beyond the 1-month horizon it was trained for
67
- - **Different telecom markets** without retraining (model behavior may not generalize)
68
- - **Individual customer harassment** or punitive actions based solely on model predictions
69
- - **Credit scoring or loan decisions** (not designed for financial risk assessment)
70
 
71
  ## Bias, Risks, and Limitations
72
 
73
- ### Technical Limitations
74
- - **Class imbalance:** The dataset has a natural churn rate of ~8-15%, which creates challenges in recall optimization
75
- - **Temporal leakage risk:** Features must be strictly from the "good phase" (months 6-8) to avoid data leakage
76
- - **Feature drift:** Telecom usage patterns change over time; model performance degrades without periodic retraining
77
- - **Missing value sensitivity:** Model requires complete feature sets; imputation strategies may introduce bias
78
 
79
- ### Sociotechnical Considerations
80
- - **Demographic bias:** If training data contains demographic information correlated with protected attributes, the model may inadvertently learn biased patterns
81
- - **Surveillance concerns:** Predictive models for customer behavior raise privacy considerations
82
- - **Feedback loops:** Aggressive retention campaigns targeting predicted churners may create self-fulfilling prophecies
83
 
84
  ### Recommendations
85
- - Regular model retraining (monthly/quarterly) to account for changing customer behaviors
86
- - A/B testing of retention interventions to measure true causal impact
87
- - Monitoring for demographic disparities in predictions across customer segments
88
- - Combining model predictions with human judgment for final retention decisions
89
- - Transparent communication with customers about data usage for service improvement
90
 
91
  ## How to Get Started with the Model
92
 
93
- ### Installation
94
- ```bash
95
- pip install -r requirements.txt
96
- ```
97
-
98
- ### Quick Start
99
- ```python
100
- import pickle
101
- import pandas as pd
102
-
103
- # Load the model
104
- with open("models/churn_model.pkl", "rb") as f:
105
- model = pickle.load(f)
106
-
107
- # Prepare features (see src/feature_engineering.py for expected format)
108
- features = pd.DataFrame({
109
- "total_calls_m6": [100],
110
- "total_calls_m7": [95],
111
- "total_calls_m8": [20],
112
- # ... other features
113
- })
114
-
115
- # Predict
116
- prediction = model.predict(features)
117
- probability = model.predict_proba(features)[:, 1]
118
- print(f"Churn Risk: {probability[0]:.2%}")
119
- ```
120
-
121
- ### API Usage
122
- ```bash
123
- curl -X POST "http://localhost:8000/predict" \
124
- -H "Content-Type: application/json" \
125
- -d '{"features": {"total_calls_m6": 100, ...}}'
126
- ```
127
 
128
  ## Training Details
129
 
130
  ### Training Data
131
 
132
- **Data Source:** Telecom customer usage data spanning 4 months (months 6-9)
133
-
134
- **Dataset Characteristics:**
135
- - **Format:** Tabular CSV with wide format (one row per customer, columns per month)
136
- - **Size:** ~30,000 high-value customers (top 70th percentile by recharge amount)
137
- - **Features:** 30+ features including:
138
- - **Usage features:** Total calls, duration, incoming/outgoing minutes (months 6-8)
139
- - **Recharge features:** Recharge amounts and counts (months 6-8)
140
- - **Internet features:** Data usage and sessions (months 6-8)
141
- - **Derived features:** Average recharge, usage trends, month-over-month changes
142
-
143
- **Target Definition:**
144
- - Churn = 1 if customer has zero incoming calls AND zero outgoing calls AND zero mobile internet usage in month 9
145
- - Churn = 0 otherwise
146
- - Typical churn rate: ~8-15% among high-value customers
147
-
148
- **Preprocessing Steps:**
149
- 1. Data validation (column checks, null handling)
150
- 2. High-value customer identification (70th percentile threshold)
151
- 3. Churn label definition based on month 9 usage
152
- 4. Feature engineering (usage ratios, trends, averages)
153
- 5. Train/test split: 80/20 with stratification by churn label
154
-
155
- ### Training Procedure
156
-
157
- #### Preprocessing
158
- - **Feature Engineering:** `src/feature_engineering.py` creates rolling averages, month-over-month ratios, and interaction features
159
- - **SMOTE:** Applied for class balancing (sampling_strategy=0.5)
160
- - **PCA:** Optional dimensionality reduction (95% variance threshold)
161
- - **Scaling:** StandardScaler for Logistic Regression (embedded in pipeline)
162
 
163
  #### Training Hyperparameters
164
 
165
- **Logistic Regression:**
166
- - C: 1.0
167
- - Penalty: l2
168
- - Solver: lbfgs
169
- - Max iterations: 1000
170
- - Class weight: balanced
171
-
172
- **Random Forest:**
173
- - N estimators: 100
174
- - Max depth: 10
175
- - Min samples split: 5
176
- - Min samples leaf: 2
177
- - Class weight: balanced
178
-
179
- **Gradient Boosting:**
180
- - N estimators: 100
181
- - Max depth: 5
182
- - Learning rate: 0.1
183
-
184
- **Training regime:** fp32 (standard scikit-learn precision)
185
-
186
- #### Speeds, Sizes, Times
187
- - **Training time:** ~2-5 minutes on standard CPU
188
- - **Inference time:** <10ms per prediction
189
- - **Model size:** ~5-15 MB per model (pickled)
190
- - **Memory usage:** ~500MB during training (30K samples)
191
 
192
  ## Evaluation
193
 
 
 
194
  ### Testing Data, Factors & Metrics
195
 
196
  #### Testing Data
197
- - **Test set:** 20% stratified holdout from original data
198
- - **Size:** ~6,000 samples (typical)
199
- - **Churn rate:** Matched to training distribution (~8-15%)
 
200
 
201
  #### Factors
202
- Evaluation is performed across:
203
- - Overall performance (all high-value customers)
204
- - Cross-validation (5-fold stratified) for robustness
205
- - Individual model comparison (Logistic Regression vs Random Forest vs Gradient Boosting)
206
 
207
- #### Metrics
208
- - **AUC-ROC:** Primary metric for ranking predictions
209
- - **F1-Score:** Balance between precision and recall
210
- - **Precision:** Minimize false alarms (don't waste retention budget)
211
- - **Recall:** Capture actual churners (don't miss at-risk customers)
212
- - **Average Precision:** Alternative to AUC for imbalanced data
213
 
214
- ### Results
215
 
216
- Performance varies by model architecture. The ensemble selects the best model based on validation AUC.
217
 
218
- **Typical Performance (Random Forest - usually best):**
219
- - AUC: ~0.85-0.92
220
- - F1: ~0.70-0.80
221
- - Precision: ~0.65-0.75
222
- - Recall: ~0.75-0.85
223
 
224
- **Logistic Regression (most interpretable):**
225
- - AUC: ~0.80-0.88
226
- - F1: ~0.65-0.75
227
 
228
- **Gradient Boosting:**
229
- - AUC: ~0.83-0.90
230
- - F1: ~0.68-0.78
231
 
232
  #### Summary
233
- The model achieves strong discriminative performance (AUC > 0.85) suitable for production deployment. Random Forest typically performs best, while Logistic Regression provides the most interpretable results for business stakeholders.
234
 
235
- ## Model Examination
236
 
237
- ### Feature Importance
238
- Top predictive features typically include:
239
- 1. **Month-over-month usage decline** (steep drops in calls/data)
240
- 2. **Average recharge amount** (lower recharge = higher risk)
241
- 3. **Recent usage patterns** (month 8 vs month 6-7 averages)
242
- 4. **Data usage consistency** (frequent data users who stop are high risk)
243
 
244
- ### Interpretability
245
- - **Logistic Regression:** Coefficients indicate feature direction and magnitude
246
- - **Random Forest:** Feature importance scores available via `sklearn`
247
- - **SHAP/Partial Dependence:** Can be computed post-hoc for individual explanations
248
 
249
- ## Environmental Impact
250
 
251
- Carbon emissions are minimal given the small dataset and efficient scikit-learn algorithms.
252
 
253
- - **Hardware Type:** Standard CPU (no GPU required)
254
- - **Hours used:** <0.1 hours per training run
255
- - **Cloud Provider:** Local/AWS (configurable)
256
- - **Compute Region:** us-east-1 (configurable)
257
- - **Carbon Emitted:** <10g CO2eq per training run (estimated)
258
 
259
- ## Technical Specifications
260
 
261
- ### Model Architecture and Objective
262
 
263
- **Objective:** Minimize binary cross-entropy loss for churn prediction
 
 
 
 
264
 
265
- **Architecture:** Ensemble of three scikit-learn classifiers:
266
- 1. Logistic Regression (linear baseline)
267
- 2. Random Forest (tree-based, handles non-linearities)
268
- 3. Gradient Boosting (sequential trees, high accuracy)
269
 
270
- **Pipeline:**
271
- ```
272
- Input Features → [Optional SMOTE] → Classifier → Churn Probability
273
- ```
274
 
275
  ### Compute Infrastructure
276
 
 
 
277
  #### Hardware
278
- - **Minimum:** 2 CPU cores, 4GB RAM
279
- - **Recommended:** 4 CPU cores, 8GB RAM
280
- - **GPU:** Not required (CPU-only training)
281
 
282
  #### Software
283
- - **Python:** 3.10+
284
- - **Key dependencies:**
285
- - scikit-learn 1.3+
286
- - pandas 2.0+
287
- - numpy 1.24+
288
- - imbalanced-learn (SMOTE)
289
- - mlflow (experiment tracking)
290
- - fastapi (serving)
291
 
292
- ## Citation
 
 
 
 
293
 
294
  **BibTeX:**
295
- ```bibtex
296
- @software{telecom_churn_mlops,
297
- title = {Telecom Churn Prediction MLOps Pipeline},
298
- author = {Sam2120},
299
- year = {2024},
300
- url = {https://github.com/Sam2120/telecom-churn-mlops}
301
- }
302
- ```
303
 
304
  **APA:**
305
- Sam2120. (2024). *Telecom Churn Prediction MLOps Pipeline* [Software]. GitHub. https://github.com/Sam2120/telecom-churn-mlops
306
 
307
- ## Glossary
 
 
 
 
308
 
309
- - **Churn:** Customer cancellation of telecom service
310
- - **High-Value Customer:** Top 70th percentile by average recharge amount in good phase months
311
- - **Good Phase:** Months 6, 7, 8 (stable period before prediction)
312
- - **Action Month:** Month 8 (last month with full data before prediction)
313
- - **SMOTE:** Synthetic Minority Over-sampling Technique (for class balancing)
314
- - **AUC:** Area Under the ROC Curve (discrimination metric)
315
- - **ARPU:** Average Revenue Per User
316
- - **MOU:** Minutes of Usage
317
 
318
- ## More Information
319
 
320
- - Full documentation: See `docs/architecture.md`
321
- - API documentation: Available at `/docs` when running the FastAPI server
322
- - MLflow UI: Run `mlflow ui` to see experiment tracking
323
- - DVC pipeline: Run `dvc repro` to reproduce the full pipeline
324
 
325
- ## Model Card Authors
326
 
327
- - MLOps Pipeline Team
328
- - Sam2120
329
 
330
  ## Model Card Contact
331
 
332
- For questions or issues, please open an issue on the GitHub repository: https://github.com/Sam2120/telecom-churn-mlops/issues
 
 
 
17
  model_name: Telecom Churn Prediction Model
18
  ---
19
 
20
+ # Model Card for Model ID
21
+
22
+ <!-- Provide a quick summary of what the model is/does. -->
23
+
24
 
 
25
 
26
  ## Model Details
27
 
28
  ### Model Description
29
 
30
+ <!-- Provide a longer summary of what this model is. -->
31
+
32
 
33
+
34
+ - **Developed by:** [More Information Needed]
35
+ - **Shared by [optional]:** [More Information Needed]
36
+ - **Model type:** [More Information Needed]
37
  - **Language(s) (NLP):** en
38
  - **License:** mit
39
+ - **Finetuned from model [optional]:** [More Information Needed]
40
+
41
+ ### Model Sources [optional]
42
 
43
+ <!-- Provide the basic links for the model. -->
44
 
45
+ - **Repository:** [More Information Needed]
46
+ - **Paper [optional]:** [More Information Needed]
47
+ - **Demo [optional]:** [More Information Needed]
48
 
49
  ## Uses
50
 
51
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
52
+
53
  ### Direct Use
54
 
55
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
 
 
56
 
57
+ [More Information Needed]
58
 
59
+ ### Downstream Use [optional]
60
 
61
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
62
+
63
+ [More Information Needed]
 
64
 
65
  ### Out-of-Scope Use
66
 
67
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
68
+
69
+ [More Information Needed]
 
 
 
70
 
71
  ## Bias, Risks, and Limitations
72
 
73
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
 
 
 
 
74
 
75
+ [More Information Needed]
 
 
 
76
 
77
  ### Recommendations
78
+
79
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
80
+
81
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
 
82
 
83
  ## How to Get Started with the Model
84
 
85
+ Use the code below to get started with the model.
86
+
87
+ [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  ## Training Details
90
 
91
  ### Training Data
92
 
93
+ <!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
94
+
95
+ [More Information Needed]
96
+
97
+ ### Training Procedure
98
+
99
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
100
+
101
+ #### Preprocessing [optional]
102
+
103
+ [More Information Needed]
104
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
  #### Training Hyperparameters
107
 
108
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
109
+
110
+ #### Speeds, Sizes, Times [optional]
111
+
112
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
113
+
114
+ [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  ## Evaluation
117
 
118
+ <!-- This section describes the evaluation protocols and provides the results. -->
119
+
120
  ### Testing Data, Factors & Metrics
121
 
122
  #### Testing Data
123
+
124
+ <!-- This should link to a Data Card if possible. -->
125
+
126
+ [More Information Needed]
127
 
128
  #### Factors
 
 
 
 
129
 
130
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
 
 
 
 
 
131
 
132
+ [More Information Needed]
133
 
134
+ #### Metrics
135
 
136
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
 
 
 
 
137
 
138
+ [More Information Needed]
 
 
139
 
140
+ ### Results
141
+
142
+ [More Information Needed]
143
 
144
  #### Summary
 
145
 
 
146
 
 
 
 
 
 
 
147
 
148
+ ## Model Examination [optional]
 
 
 
149
 
150
+ <!-- Relevant interpretability work for the model goes here -->
151
 
152
+ [More Information Needed]
153
 
154
+ ## Environmental Impact
 
 
 
 
155
 
156
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
157
 
158
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
159
 
160
+ - **Hardware Type:** [More Information Needed]
161
+ - **Hours used:** [More Information Needed]
162
+ - **Cloud Provider:** [More Information Needed]
163
+ - **Compute Region:** [More Information Needed]
164
+ - **Carbon Emitted:** [More Information Needed]
165
 
166
+ ## Technical Specifications [optional]
 
 
 
167
 
168
+ ### Model Architecture and Objective
169
+
170
+ [More Information Needed]
 
171
 
172
  ### Compute Infrastructure
173
 
174
+ [More Information Needed]
175
+
176
  #### Hardware
177
+
178
+ [More Information Needed]
 
179
 
180
  #### Software
 
 
 
 
 
 
 
 
181
 
182
+ [More Information Needed]
183
+
184
+ ## Citation [optional]
185
+
186
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
187
 
188
  **BibTeX:**
189
+
190
+ [More Information Needed]
 
 
 
 
 
 
191
 
192
  **APA:**
 
193
 
194
+ [More Information Needed]
195
+
196
+ ## Glossary [optional]
197
+
198
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
199
 
200
+ [More Information Needed]
 
 
 
 
 
 
 
201
 
202
+ ## More Information [optional]
203
 
204
+ [More Information Needed]
 
 
 
205
 
206
+ ## Model Card Authors [optional]
207
 
208
+ [More Information Needed]
 
209
 
210
  ## Model Card Contact
211
 
212
+ [More Information Needed]
213
+
214
+