top of page

Customer Churn Prediction

  • Jun 28
  • 4 min read

# مشروع التنبؤ بفقد العملاء — وصف المشروع والنتائج

Project Overview & Results


---


## وصف المشروع | Project Description


يهدف هذا المشروع إلى بناء نموذج تنبؤي قادر على تحديد العملاء الأكثر عرضة للانسحاب (الفقد) من خدمات الشركة. تم تطوير المشروع بالكامل باستخدام بيانات حقيقية مستخرجة من النظام الداخلي للشركة، وتغطي تاريخ حركة العملاء منذ عام 2023 حتى مايو 2026.


This project aims to build a predictive model capable of identifying customers most at risk of churning from the company's services. The project was developed entirely using real data extracted from the company's internal system, covering customer activity from 2023 through May 2026.


---


## المشكلة | The Problem


تعاني الشركة من فقد مستمر في قاعدة عملائها دون وجود آلية استباقية للكشف المبكر عن العملاء المعرضين للانسحاب. كان الاعتماد على المتابعة اليدوية بعد وقوع الفقد فعلياً، مما يجعل التدخل متأخراً وغير فعّال في أغلب الأحيان.


The company has been experiencing continuous customer loss without a proactive mechanism for early detection of at-risk customers. Reliance on manual follow-up after churn had already occurred made interventions late and largely ineffective.


---


## البيانات المستخدمة | Data Used


تم استخدام قاعدة بيانات تحتوي على **20,914 سجل عميل** تشمل المتغيرات التالية:

A dataset containing **20,914 customer records** was used, including the following variables:

| المتغير / Variable | الوصف / Description |

|---|---|

| `customer_status` | حالة العميل (active / lost) — Target Variable |

| `customer_type` | نوع العميل (فردي / مجموعة) — single / group |

| `instal_amount` | قيمة القسط الشهري — Monthly installment amount |

| `instal_count` | عدد الأقساط المسددة — Number of installments paid |

| `winning_status` | هل العميل فائز برحلة — Whether the customer won a trip |

| `total_paid` | إجمالي ما دفعه العميل — Total amount paid by customer |

| `pay_status` | حالة الالتزام بالسداد — Payment commitment status |


---


## منهجية العمل | Methodology


تم تنفيذ المشروع عبر المراحل التالية بالتسلسل:


The project was executed through the following sequential stages:


🔹 Data Preparation

  • Data Cleaning: Remove duplicates, convert data types, and handle special placeholder values (e.g., 1900-01-01 → null).

  • Feature Engineering: Derive new variables such as winning_status, travel_status, pay_status, and customer_type.

  • Label Encoding: Convert categorical text variables into numeric values.

🔹 Model Development

  • Train-Test Split: Divide dataset into 70% training and 30% testing subsets.

  • Model Training: Apply Logistic Regression with 1000 iterations for convergence.

🔹 Model Evaluation

  • Performance Metrics: Assess model using Precision, Recall, F1-Score, and Confusion Matrix.

  • Probability Scoring: Add churn probability for each customer, scaled from 0 to 100.

---


## النتائج | Results


حقق النموذج أداءً استثنائياً في التنبؤ بالعملاء المعرضين للفقد:


The model achieved exceptional performance in predicting at-risk customers:


| المقياس / Metric | القيمة / Value |

|---|---|

| **Accuracy** | **98%** |

| **Precision** | **97.47%** |

| **Recall** | **99.96%** |

| **F1-Score** | **98.70%** |




Confusion Matrix:

  • 5014 — predicted churn correctly ✅ (True Positives)

  • 1128 — predicted active correctly ✅ (True Negatives)

  • 2 — missed churners ❌ (False Negatives) — only 2!

  • 130 — false alarms ⚠️ (False Positives)

Description:


Out of 6,274 test cases, the model correctly identified 5,014 at-risk customers and missed only 2. In a retention context, missing a churner is far more costly than a false alarm — this model prioritizes catching every at-risk customer before they leave.

Built on 20,914 real production records | Logistic Regression | Python + scikit-learn"



🔹 Early Intervention Impact

  • Pre-Churn Detection: The model identifies customers before actual churn occurs, enabling proactive retention strategies.

  • High Recall Rate: With 99.96% of at-risk customers detected, the system ensures almost all potential losses are flagged.

  • Business Value: This capability allows the team to intervene early, strengthen customer relationships, and significantly reduce attrition.



## مخرجات النموذج | Model Output


ينتج النموذج لكل عميل نسبه مئويه تستخدم لتصميف العميل حسب مستوي الخطر

The model generates a **Churn Probability Score (0–100)** for each customer, used to classify them by risk level:

| مستوى الخطر / Risk Level | نطاق الاحتمالية / Probability Range | التوصية / Recommendation |


| 🔴 خطر عالي / High Risk | > 80% | تدخل فوري — Immediate intervention |

| 🟡 خطر متوسط / Medium Risk | 40% – 80% | متابعة مكثفة — Close monitoring |

| 🟢 آمن / Low Risk | < 40% | متابعة عادية — Routine follow-up |


---


## التوصيات | Recommendations



Based on the model results, the following is recommended:

1. تطبيق النموذج دورياً (أسبوعياً) على قاعدة العملاء الكاملة لاستخراج قائمة العملاء عالي الخطر.

Run the model weekly on the full customer base to generate a high-risk customer list.


2. تطوير النموذج مستقبلاً بإضافة متغيرات إضافية (عمر العميل مع الشركة، عدد الشكاوى، آخر تفاعل).

Enhance the model by adding more features (customer tenure, complaints count, last interaction date).


3. ربط المخرجات بلوحة تحكم تفاعلية (Power BI) لتسهيل المتابعة من قبل الإدارة.

Connect the output to an interactive dashboard (Power BI) for management-level monitoring.


---


## التقنيات المستخدمة | Technologies Used


| الأداة / Tool | الاستخدام / Purpose |

|---|---|

| Python (pandas, numpy) | تنظيف البيانات / Data Cleaning |

| scikit-learn | بناء النموذج / Model Training |

| statsmodels | التحليل الإحصائي / Statistical Analysis |

| matplotlib / seaborn | التصور البياني / Visualization |

| VS Code + Jupyter | بيئة التطوير / Development Environment |


---


*تاريخ المشروع: مايو 2026 — Project Date: May 2026*
 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page