View
39
Download
6
Category
Preview:
DESCRIPTION
הערכת טיב המודל F-Measure, Kappa, Costs, MetaCost. ד"ר אבי רוזנפלד. הגדרות. False Positives / Negatives. Confusion matrix 1. Confusion matrix 2. FN. Actual. Actual. FP. Predicted. Predicted. Precision (P) = 20 / 50 = 0.4 Recall (P) = 20 / 30 = 0.666 F-measure=2*.4*.666/1.0666=.5. - PowerPoint PPT Presentation
Citation preview
המודל טיב הערכת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
P N
P 20 10
N 30 90
Predicted
Actu
al
Confusion matrix 1
P N
P 10 20
N 15 105
Predicted
Actu
al
Confusion matrix 2
FN
FP
Precision (P) = 20 / 50 = 0.4Recall (P) = 20 / 30 = 0.666F-measure=2*.4*.666/1.0666=.5
The Kappa Statistic
• Kappa measures relative improvement over random prediction• Dreal / Dperfect = A (accuracy of the real model)
• Drandom / Dperfect= C (accuracy of a random model)• Kappa Statistic = (A-C) / (1-C)= (Dreal / Dperfect – Drandom / Dperfect ) / (1 – Drandom / Dperfect )
Remove Dperfect from all places
• (Dreal – Drandom) / (Dperfect – Drandom) • 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 = (Dreal – Drandom) / (Dperfect – Drandom)
– (140 – 82) / (200 – 82) = 0.492– Accuracy = 140/200 = 0.70
a b c
a 88 10 2 100
b 14 40 6 60
c 18 10 12 40
120
60 20 200
Actu
al
Predicted
total
total a b c
a 60 30 10 100
b 36 18 6 60
c 24 12 4 40
120
60 20 200
Actu
al
Predicted
total
total
The kappa statistic – how to calculate Drandom ?
a b c
a 88 10 2 100
b 14 40 6 60
c 18 10 12 40
120
60 20 200
Actu
al
total
total a b c
a ? 100
b 60
c 40
120
60 20 200
Actu
altotal
total
100*120/200 = 60Rationale: 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
טוב יותר מצב ???איזה
P N
P 20 10
N 30 90
Predicted
Actu
al
P N
P 0 2
N 1 0
Confusion matrix 2
Cost matrix
P N
P 10 20
N 15 105
Predicted
Actu
al
Confusion matrix 1
FN
FP
Error rate: 40/150Cost: 30x1+10x2=50
Error rate: 35/150Cost: 15x1+20x2=55
FN
MetaCost
• By wrapping a cost-minimizing procedure, “meta-learning” stage, around the classifier
•" " שחורה קופצה כ הלמידה לסוג תתייחסה • את לשנות התוצאות COSTאפשר על ולהשפיע
דוגמא:מפעילים אנשים CRUISE CONTROLמתי
0 0.1 0.2 0.3 0.4 0.5 0.6 0.775
77
79
81
83
85
87
89
91
93
95
AllWithout
Recall of Minority Case
Ove
rall
Accu
racy
WEKAמתוך Metacost עלות תוספת בלי
WEKAמתוך Metacost עלות עם
Recommended