ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
Confusion Matrix က classification result ကို ၄ category (True Positive, True Negative, False Positive, False Negative) ခွဲပြထားတဲ့ table ပါ — Accuracy (correct prediction/total) တစ်ခုတည်းက class imbalance ရှိတဲ့ dataset မှာ misleading ဖြစ်နိုင်ပါတယ် (Intermediate lesson 2 ရဲ့ spam example ကလို)။ Precision (positive predict ချတာထဲက ဘယ်နှစ်ခု really positive လဲ, false alarm နည်းချင်တဲ့အခါ ဦးစားပေး) နဲ့ Recall (real positive ထဲက ဘယ်နှစ်ခု ဖမ်းမိလဲ, false negative ဆိုးရွားတဲ့ scenario ဥပမာ - disease detection မှာ ဦးစားပေး) ကြား trade-off ရှိပါတယ် — F1 Score ကတော့ Precision/Recall ၂ ခုစလုံးကို balance ပေးတဲ့ single metric ပါ.
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Cancer detection model တစ်ခုမှာ — Recall ကို ဦးစားပေးသင့်ပါတယ် (patient တစ်ယောက်ကို 'ရောဂါမရှိဘူး' လို့ မှားခန့်မှန်းရင် (False Negative) ဘဝနစ်နာမှု ကြီးမားနိုင်လို့), Spam filter မှာတော့ Precision ကို ဦးစားပေးနိုင်ပါတယ် (important email ကို spam လို့ မှားခန့်မှန်းရင် (False Positive) user disturb ဖြစ်နိုင်လို့) — `from sklearn.metrics import classification_report; print(classification_report(y_test, predictions))` ကို run ရင် metric အားလုံးကို table format ဖြင့် တစ်ပြိုင်နက် ကြည့်နိုင်ပါတယ်.
အတူတူ ကြည့်မယ်
from sklearn.metrics import confusion_matrix, classification_report
predictions = model.predict(X_test)
print(confusion_matrix(y_test, predictions))
print(classification_report(y_test, predictions))[[85 5]
[10 100]]
precision recall f1-score
0 0.89 0.94 0.92
1 0.95 0.91 0.93၅ မိနစ် စမ်းကြည့်
Classification model (Intermediate lesson 2 ရဲ့ spam example) ကို `confusion_matrix()`/`classification_report()` ဖြင့် evaluate ကြည့်ပြီး, Precision/Recall/F1 value ကို ဖတ်ရှင်းကြည့်ပါ — ဘယ် metric ကို ဒီ use case အတွက် ဦးစားပေးသင့်လဲ ရေးကြည့်ပါ။
သတိလေးတစ်ချက်
Metric ကို test set တစ်ခုတည်းနဲ့ တစ်ကြိမ်ပဲ ကြည့်ပြီး final decision ချခြင်းသည် statistically unreliable ဖြစ်နိုင်ပါတယ် — Cross-Validation (နောက် lesson) ကို သုံးရင် ပိုတည်ငြိမ်တဲ့ estimate ရနိုင်ပါတယ်.