Thuta Learning
Machine Learning Basics
ProjectsData & Databasesအလယ်အလတ်

Project — Customer Churn Classification

Machine Learning Basicsသင်ခန်းစာ 22

ဒီခန်းပြီးရင် ဘာတတ်သွားမလဲ

  • Project — Customer Churn Classification ကို ကြောက်စရာမလိုအောင် နားလည်မယ်
  • ကိုယ်တိုင် scikit-learn code ကို run ကြည့်တတ်မယ်
  • Real project ထဲမှာ ဒီ concept ကို ချက်ချင်း အသုံးချတတ်မယ်

ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်

Customer Churn Prediction က business context မှာ အသုံးအများဆုံး classification use case တစ်ခုပါ — customer ရဲ့ behavior data (usage frequency, support ticket count, contract length) ကနေ 'ဒီ customer က ရက်သတ္တပတ်ရှေ့မှာ subscription ဖျက်နိုင်ခြေ ရှိလား' ဆိုတာကို predict ချပါတယ် — business team က high-risk customer ကို proactive ဖြင့် retention offer ပေးနိုင်ပါတယ်။ Class Imbalance (churn customer < non-churn customer, real-world မှာ အများအားဖြင့်) ကို ဒီ project မှာ တွေ့ရနိုင်လို့, Intermediate chapter ရဲ့ Precision/Recall/F1 concept ကို directly အသုံးချရပါလိမ့်မယ်.

လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်

Customer dataset (usage_frequency, support_tickets, contract_length, churned) ကို — Logistic Regression + Random Forest Classifier ၂ ခုကို train, `classification_report()` ဖြင့် Precision/Recall/F1 compare, Random Forest ရဲ့ `feature_importances_` ကို ကြည့်ပြီး 'ဘယ် factor က churn ကို အများဆုံး ခန့်မှန်းနိုင်လဲ' ဆိုတာ business team ဆီ report ချရေးကြည့်ပါ.

အတူတူ ကြည့်မယ်

python
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report

model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(X_train, y_train)

predictions = model.predict(X_test)
print(classification_report(y_test, predictions))

# Which features matter most for predicting churn?
importances = sorted(zip(X.columns, model.feature_importances_), key=lambda x: -x[1])
for feature, importance in importances:
    print(f"{feature}: {importance:.2f}")
You should see
              precision    recall  f1-score
           0       0.91      0.95      0.93
           1       0.78      0.65      0.71

support_tickets: 0.42
usage_frequency: 0.35
contract_length: 0.23

၅ မိနစ် စမ်းကြည့်

Customer churn sample dataset ကို ကိုယ်တိုင် create ပြီး, full classification pipeline ကို run ကြည့်ပါ — `feature_importances_` ရလဒ်ကို ကြည့်ပြီး business team ဆီ ပေးမယ့် 1-paragraph insight ကို ရေးကြည့်ပါ။

သတိလေးတစ်ချက်

Customer data ကို ML model အတွက် သုံးတဲ့အခါ privacy/data protection regulation (ဥပမာ - GDPR) ကို လိုက်နာရန် လိုအပ်ပါတယ် — real customer data ကို authorization/consent မရှိဘဲ model training အတွက် သုံးခြင်းသည် legal issue ဖြစ်နိုင်ပါတယ်.

ဒီနေရာမှာ လူအများမှားတတ်တယ်

  • Churn class (minority class) ရဲ့ Recall ကို 65% ဆိုပြီး 'accuracy 91%' တစ်ခုတည်းကို ကြည့်ပြီး 'model ကောင်းတယ်' လို့ ချုပ်ချင်းချကွက်ဆုံးဖြတ်ခြင်း — minority class ရဲ့ metric ကို သတိထားစစ်ဆေးရပါမယ်
  • Feature importance result ကို 'causation' (ဒီ factor ကြောင့် churn ဖြစ်တယ်) လို့ တိုက်ရိုက် ယူဆခြင်း — correlation ကိုသာ ဖော်ပြတာပါ, business decision ချခင် domain expert အတည်ပြုချက် လိုအပ်ပါတယ်

အခု ကိုယ်တိုင် စမ်းကြည့်

Customer churn sample dataset ကို ကိုယ်တိုင် create ပြီး, full classification pipeline ကို run ကြည့်ပါ — `feature_importances_` ရလဒ်ကို ကြည့်ပြီး business team ဆီ ပေးမယ့် 1-paragraph insight ကို ရေးကြည့်ပါ။

အလုပ်ဖြစ်ကြောင်း ဒီလိုသိမယ်: precision recall f1-score 0 0.91 0.95 0.93 1 0.78 0.65 0.71 support_tickets: 0.42 usage_frequency: 0.35 contract_length: 0.23

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Project — Customer Churn Classification | Thuta Learning