הערכת טיב המודל F-Measure, Kappa, Costs, MetaCost ד " ר אבי רוזנפלד
הגדרות נוסחהמשמעותמדד TP / (TP + FP) בכמה אחוזים דייקתי בקטגוריה מסוימת ( מתוך אלו שאמרתי הם בקטגוריה ) Precision TP / (TP + FN) בכמה אחוזים דייקתי בכלל במופעים בקטגוריה Recall 2*precision*recall/ precision+recall Harmonic mean of precision and recall F-Measure (TP + TN) / ( הכול ) הדיוק הכללי Accuracy
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 = F-measure=2*.4*.666/1.0666=.5
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
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) = – Accuracy = 140/200 = 0.70 abc a b c Actual Predicted total abc a b c Actual Predicted total
The kappa statistic – how to calculate D random ? abc a b c Actual total abc a?100 b60 c 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
Cost-Sensitive Learning מוסיפים עלות לכל סוג של סיווג בדרך כלל, אלגוריתמים לא מפרידים בין קטגוריות אבל יש ה - ר - ב - ה יישומים שזה חשוב : –אבחון סרטן –אבחון סיכונים ( התקפות מחשב, זיוף, וכו ')
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
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
איזה מצב יותר טוב ??? 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
MetaCost By wrapping a cost-minimizing procedure, “meta- learning” stage, around the classifier תתייחס לסוג הלמידה כ " קופצה שחורה " אפשר לשנות את ה COST ולהשפיע על התוצאות
דוגמא : מתי אנשים מפעילים CRUISE CONTROL
מתוך WEKA Metacost בלי תוספת עלות
מתוך WEKA Metacost עם עלות