Presentation is loading. Please wait.

Presentation is loading. Please wait.

הערכת טיב המודל F-Measure, Kappa, Costs, MetaCost ד " ר אבי רוזנפלד.

Similar presentations


Presentation on theme: "הערכת טיב המודל F-Measure, Kappa, Costs, MetaCost ד " ר אבי רוזנפלד."— Presentation transcript:

1 הערכת טיב המודל F-Measure, Kappa, Costs, MetaCost ד " ר אבי רוזנפלד

2 הגדרות נוסחהמשמעותמדד TP / (TP + FP) בכמה אחוזים דייקתי בקטגוריה מסוימת ( מתוך אלו שאמרתי הם בקטגוריה ) Precision TP / (TP + FN) בכמה אחוזים דייקתי בכלל במופעים בקטגוריה Recall 2*precision*recall/ precision+recall Harmonic mean of precision and recall F-Measure (TP + TN) / ( הכול ) הדיוק הכללי Accuracy

3 False Positives / Negatives PN P2010 N3090 Predicted Actual Confusion matrix 1 PN P1020 N15105 Predicted Actual Confusion matrix 2 FN FP Precision (P) = 20 / 50 = 0.4 Recall (P) = 20 / 30 = 0.666 F-measure=2*.4*.666/1.0666=.5

4 The Kappa Statistic Kappa measures relative improvement over random prediction D real / D perfect = A (accuracy of the real model) D random / D perfect = C (accuracy of a random model) Kappa Statistic = (A-C) / (1-C) = (D real / D perfect – D random / D perfect ) / (1 – D random / D perfect ) Remove D perfect from all places (D real – D random ) / (D perfect – D random ) Kappa = 1 when A = 1 Kappa  0 if prediction is no better than random guessing

5 Aside: the Kappa statistic Two confusion matrix for a 3-class problem: real model (left) vs random model (right) Number of successes: sum of values in diagonal (D) Kappa = (D real – D random ) / (D perfect – D random ) – (140 – 82) / (200 – 82) = 0.492 – Accuracy = 140/200 = 0.70 abc a88102100 b1440660 c18101240 1206020200 Actual Predicted total abc a603010100 b3618660 c2412440 1206020200 Actual Predicted total

6 The kappa statistic – how to calculate D random ? abc a88102100 b1440660 c18101240 1206020200 Actual total abc a?100 b60 c40 1206020200 Actual total 100*120/200 = 60 Rationale: 100 actual values, 120/200 in the predicted class, so random is: 100*120/200 Actual confusion matrix, C Expected confusion matrix, E, for a random model

7 Cost-Sensitive Learning מוסיפים עלות לכל סוג של סיווג בדרך כלל, אלגוריתמים לא מפרידים בין קטגוריות אבל יש ה - ר - ב - ה יישומים שזה חשוב : –אבחון סרטן –אבחון סיכונים ( התקפות מחשב, זיוף, וכו ')

8 Class Imbalance vs. Asymmetric Misclassification costs Class Imbalance: one class occurs much more often than the other Asymmetric misclassification costs: the cost of misclassifying an example from one class is much larger than the cost of misclassifying an example from the other class. לפי הניסיון שלי : שני המוסגים בדרך כלל באים ביחד גם הפתרונות דומות דוגמאות : –תוריד שורות מה MAJORITY CLASS –תוסיף שורות ל MINORITY CLASS –תוסיף עלות ל MINORITY -- METACOST

9 Making Classifier Balanced Baseline Methods – Random over-sampling – Random under-sampling Under-sampling Methods – Tomek links – Condensed Nearest Neighbor Rule – One-sided selection – CNN + Tomek links – Neighborhood Cleaning Rule Over-sampling Methods – Smote Combination of Over-sampling method with Under-sampling method – Smote + Tomek links – Smote + ENN

10 איזה מצב יותר טוב ??? PN P2010 N3090 Predicted Actual PN P02 N10 Confusion matrix 2 Cost matrix PN P1020 N15105 Predicted Actual Confusion matrix 1 FN FP Error rate: 40/150 Cost: 30x1+10x2=50 Error rate: 35/150 Cost: 15x1+20x2=55 FN

11 MetaCost By wrapping a cost-minimizing procedure, “meta- learning” stage, around the classifier תתייחס לסוג הלמידה כ " קופצה שחורה " אפשר לשנות את ה COST ולהשפיע על התוצאות

12 דוגמא : מתי אנשים מפעילים CRUISE CONTROL

13 מתוך WEKA Metacost בלי תוספת עלות

14 מתוך WEKA Metacost עם עלות


Download ppt "הערכת טיב המודל F-Measure, Kappa, Costs, MetaCost ד " ר אבי רוזנפלד."

Similar presentations


Ads by Google