Classification Metrics.pptx
Classification Metrics.pptx
Binary classification
•Task of classifying the elements of a set into two groups on
the basis of a classification rule.
•Observed response (output) ‘y’ takes only two possible
values + / – , or T/ F .
• Need to define the relationship between h(x) and y
• Use the decision rule:
Ex:
•Medical test- to determine if a patient has certain disease or not;
•Is the person fit or not
•Spam email classification
Definition
Instances
• The objects of interest in machine learning
Instance space [ ]
• The set of all possible instances
• Example: set of all possible e-mails
Label Space
• The label space is used in supervised learning to label the examples
Model
• In order to achieve the task under consideration we need a model:
a mapping from the instance space to the output space.
• For instance, in classification the output space is a set of classes,
while in regression it is the set of real numbers.
• In order to learn such a model we require a training set of labelled
instances (x, l(x)), also called examples
Assessing classification
performance
• The outputs of learning algorithms need to be
assessed and analyzed carefully and this
analysis must be interpreted correctly, so as to
evaluate different learning algorithms.
An ROC curve plots TPR vs. FPR at different classification thresholds. Lowering the
classification threshold classifies more items as positive, thus increasing both False
Positives and True Positives
https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc
ROC Curve
Let us consider the hypothetical data,
True Labels: [1, 0, 1, 0, 1, 1, 0, 0, 1, 0]
Predicted Probabilities: [0.8, 0.3, 0.6, 0.2, 0.7, 0.9, 0.4, 0.1, 0.75, 0.55]
https://www.geeksforgeeks.org/auc-roc-curve/
ROC Curve
Actual Class Predicted
Probability
• Set different
1 0.8
thresholds 0, 0.2, 0.4,
0 0.96 0.6, 0.8, 1 and
1 0.4 generate ROC curve
1 0.3 by plotting between
0 0.2 TPR and FPR.
1 0.7
Problem 2
Problem 3
Example
Actual Predicted
1. Set Threshold
P 2. Calculate TP, T >=0.8
N TN, FP, FN
N 3. Calculate TPR
N and FPR
N 4. Draw ROC curve
N with FPR vs TPR
N
N A\P C ¬C
N C TP FN P
N
N ¬C FP TN N
P’ N’ All
https://developers.google.com/machine-learning/crash-course/classification/roc-and-auc
30
https://medium.com/greyatom/lets-learn-about-auc-roc-curve-4a94b4d88152
AUC CURVE
31
Class Probability Estimation
• The probability of an event is the likelihood that the event will
happen.
• Not only predicting the class label, but also obtaining a probability of
the respective label – use the estimated class probability for decision
making.
• Defn: A probabilistic classifier is a classifier that is able to predict,
given an observation of an input, a probability distribution over
a set of classes.
• Binary (ordinary) classifier uses function, that assigns to a
sample ’x’ a class label ‘ŷ’
ŷ= f(x)