الماشين ليرنينج · AI216

شرح الـ ROC Curve والـ AUC

الماشين ليرنينج شروحات ومراجعات

الـ ROC curve بترسم الـ true positive rate (recall) ضد الـ false positive rate عند كل threshold، والمساحة تحتها (AUC) بتلخص جودة الـ classifier في رقم واحد.

الـ classifier زي SGDClassifier بيحسب score بدالة اسمها decision function. لو الـ score أكبر من الـ threshold بيحط الـ instance في الـ positive class وإلا في الـ negative. تحريك الـ threshold بيغير عدد الـ true والـ false positives. الـ ROC (receiver operating characteristic) بيوريك الـ trade-off ده كله: المحور الرأسي TPR (الـ recall) والأفقي FPR = FP / (FP + TN) وده بيساوي 1 - specificity.

الـ classifier المثالي الـ ROC AUC بتاعه = 1. الـ random classifier بيطلع خط قطري وAUC = 0.5. كل ما الـ recall يزيد الـ false positives بتزيد، فالمنحنى الكويس بيلزق في الركن العلوي الشمال. الـ Youden index = sensitivity + specificity - 1 وبيحدد أحسن نقطة threshold.

قاعدة عملية: استخدم الـ precision/recall curve لما الـ positive class نادر أو لما الـ false positives تهمك أكتر من الـ false negatives، غير كده الـ ROC شكل عام كويس. الـ ROC أداة للـ binary classifiers.

أهم النقاط

  • ROC: الـ TPR (رأسي) ضد الـ FPR (أفقي) عند كل threshold.
  • AUC = 1 مثالي و0.5 عشوائي.
  • الـ recall الأعلى معاه false positives أكتر.
  • Youden index = sensitivity + specificity - 1.
  • استخدم الـ PR curve لو الـ positive class نادر.

مثال محلول

لو عند threshold معين الـ classifier لقى 90% من الـ positives (TPR 0.90) وغلط في 20% من الـ negatives (FPR 0.20) تبقى نقطة (0.20, 0.90). تحريك الـ threshold بيرسم المنحنى كله.

أسئلة شائعة

كام الـ ROC AUC لـ classifier عشوائي؟

0.5.

ROC اختصار لإيه؟

Receiver operating characteristic.

أسئلة تدريب على الموضوع ده

جرّبها بنفسك، وبعدين افتح التطبيق وشوف الإجابة والشرح.

  1. In the basic Scikit-Learn classifier API as taught in the course, Scikit-Learn lets you set the threshold directly
    • A. false
    • B. true
  2. ....................evaluates the discriminative power of the test
    • A. YI
    • B. MCC
    • C. DSC
    • D. none of them
  3. If that score is greater than a threshold, it assigns the instance to the ............
    • A. positive class
    • B. negative class
    • C. both of them
    • D. none of them
  4. precision recall curve() computes..............for all possible thresholds.
    • A. precision and recall
    • B. precision
    • C. recall
    • D. F-measure
  5. What is the ROC AUC of a purely random classifier
    • A. 0.5
    • B. 1
    • C. 0
    • D. none of them
  6. If that threshold is greater than a score, it assigns the instance to the ............
    • A. negative class
    • B. positive class
    • C. both of them
    • D. none of them