Lecture11evaluationmetricsforclassification 240913060639 0c766554
Lecture11evaluationmetricsforclassification 240913060639 0c766554
tion
Confusion Matrix, Precision, Re-
call, F-score, Accuracy, ROC
curve
BINARY CLASSIFIER
CONFUSION MATRIX
ACCURACY
PRECISION
RECALL
ROC CURVE
- HOW TO PLOT ROC CURVE
2
Binary Classifier
3
Confusion Matrix
4
Confusion Matrix
5
Confusion Matrix
6
Accuracy
7
Precision
8
Recall
9
Example 1
= = = 170/300 = .556
= = .5
= = .5
= = .667
= 0.556
= = .3
= = .6
= = 0.8
P = 0.556
11
Precision vs Recall
12
The F-measure
β=1
i.e., with β = 1 or α = ½
2 𝑃𝑅
Thus, the F1-measure can be computed using the following equation:
𝐹 1=
𝑃+𝑅
For example 1, precision was 1.0 and recall was 0.4, therefore, F1-measure can
13
The F1-measure (Example)
In example 1:
Precision was 1.0 2 𝑃𝑅
𝐹 1=
Recall was 0.4
𝑃+𝑅
Therefore, F1-measure can be computed as:
2∗ 1.0 ∗0.4
𝐹 1=
1.0+ 0.4
0.8
𝐹 1= =0.57
1.4
14
ROC Curve
Binary classification Confusion Ma-
trix
ROC Curve basics
17
ROC Curve basics (contd.)
18
ROC Curve basics (contd.)
20
ROC Curve presumption
Before, we can plot the ROC curve, it is assumed that the classifier produces a positivity score,
which can then be used to determine a discrete label.
E.g. in case of NB classifier, the positivity score is the probability of positive class given the
test example. Usually, a cut-off threshold v = 0.5 is applied on this positivity score for pro-
ducing the output label.
In case of ML algorithms, that produce a discrete label for the test examples, slight modifications
can be made to produce a positivity score, e.g.
1. In KNN algorithm with K=3, majority voting is used to produce a discrete output label.
However, a positive score can be produced by computing the probability/ratio of posi-
tive neighbors of the test example.
i.e. if K=3, and the labels for closest neighbors are: [1, 0, 1], then the positivity score
may be (1+0+1)/3 = 2/3 = 0.66. A cut-off threshold v can be applied on this positivity
score to produce an output label, usually, v = 0.5.
For decision tree algorithm, refer to the following link:
https://stats.stackexchange.com/questions/105760/how-we-can-draw-an-roc-curve-for-decision-trees
21
ROC Curve presumption
22
How to Plot ROC Curve - Example
23
How to Plot ROC Curve - Example
24
How to Plot ROC Curve
25
ROC Curve
26
ROC Curve
27
The AUC measure
28