Introduction to Machine Learning Evaluation: Measures for Binary - - PowerPoint PPT Presentation

introduction to machine learning evaluation measures for
SMART_READER_LITE
LIVE PREVIEW

Introduction to Machine Learning Evaluation: Measures for Binary - - PowerPoint PPT Presentation

Introduction to Machine Learning Evaluation: Measures for Binary Classification: ROC visualization compstat-lmu.github.io/lecture_i2ml LABELS: ROC SPACE Plot True Positive Rate and False Positive Rate: 1.00 True Class y C2 +


slide-1
SLIDE 1

Introduction to Machine Learning Evaluation: Measures for Binary Classification: ROC visualization

compstat-lmu.github.io/lecture_i2ml

slide-2
SLIDE 2

LABELS: ROC SPACE

Plot True Positive Rate and False Positive Rate:

  • C1

C2 C3 unclear winner dominates

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

FPR TPR True Class y

+ −

Pred.

+

TP FP

ˆ

y

FN TN TPR =

TP TP+FN

FPR =

FP FP+TN

c

  • Introduction to Machine Learning – 1 / 16
slide-3
SLIDE 3

LABELS: ROC SPACE

The best classifier lies on the top-left corner The diagonal ≈ random labels (with different proportions). Assign positive x as "pos" with 25% probability → TPR = 0.25. Assign negative x as "pos" with 25% probability → FPR = 0.25.

  • Best

Pos−100% Pos−0% Pos−25% Pos−75%

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

FPR TPR

c

  • Introduction to Machine Learning – 2 / 16
slide-4
SLIDE 4

LABELS: ROC SPACE

In practice, we should never obtain a classifier below the diagonal. Inverting the predicted labels (0 → 1 and 1 → 0) will result in a reflection at the diagonal.

  • C1

C2

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

FPR TPR

c

  • Introduction to Machine Learning – 3 / 16
slide-5
SLIDE 5

LABEL DISTRIBUTION IN TPR AND FPR

TPR and FPR are insensitive to the class distribution: Not affected by changes in the ratio n+/n− (at prediction). Example 1: Proportion n+/n− = 1

Actual Positive Actual Negative

  • Pred. Positive

40 25

  • Pred. Negative

10 25

MCE = 35/100 TPR = 0.8 FPR = 0.5 Example 2: Proportion n+/n− = 2

Actual Positive Actual Negative

  • Pred. Positive

80 25

  • Pred. Negative

20 25

MCE = 45/150 = 30/100 TPR = 0.8 FPR = 0.5 Note: If class proportions differ during training, the above is not true. Estimated posterior probabilities can change!

c

  • Introduction to Machine Learning – 4 / 16
slide-6
SLIDE 6

FROM PROBABILITIES TO LABELS: ROC CURVE

Remember: Both probabilistic and scoring classifiers can output classes by thresholding. h(x) := [π(x)) ≥ c]

  • r

h(x) = [f(x) ≥ c] To draw a ROC curve: Iterate through all possible thresholds c

→ Visual inspection of all

possible thresholds / results

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate

c

  • Introduction to Machine Learning – 5 / 16
slide-7
SLIDE 7

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate c = 0.9

→ TPR = 0.167 → FPR = 0

c

  • Introduction to Machine Learning – 6 / 16
slide-8
SLIDE 8

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate c = 0.85

→ TPR = 0.333 → FPR = 0

c

  • Introduction to Machine Learning – 7 / 16
slide-9
SLIDE 9

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate c = 0.66

→ TPR = 0.5 → FPR = 0

c

  • Introduction to Machine Learning – 8 / 16
slide-10
SLIDE 10

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate c = 0.6

→ TPR = 0.5 → FPR = 0.167

c

  • Introduction to Machine Learning – 9 / 16
slide-11
SLIDE 11

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate c = 0.55

→ TPR = 0.667 → FPR = 0.167

c

  • Introduction to Machine Learning – 10 / 16
slide-12
SLIDE 12

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate c = 0.3

→ TPR = 0.833 → FPR = 0.5

c

  • Introduction to Machine Learning – 11 / 16
slide-13
SLIDE 13

ROC CURVE

# 1 Truth 2 Score 3 4 5 6 7 8 9 10 11 12 Pos Pos Pos Neg Pos Neg Pos Neg Neg Neg Pos Neg 0.95 0.86 0.69 0.65 0.59 0.52 0.51 0.39 0.28 0.18 0.15 0.06

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate

c

  • Introduction to Machine Learning – 12 / 16
slide-14
SLIDE 14

ROC CURVE

The closer the curve to the top-left corner, the better If ROC curves cross, a different model can be better in different parts of the ROC space

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

FPR TPR model

very good

  • k1
  • k2

bad

c

  • Introduction to Machine Learning – 13 / 16
slide-15
SLIDE 15

AUC: AREA UNDER ROC CURVE

The AUC (in [0,1]) is a single metric to evaluate scoring classifiers AUC = 1: Perfect classifier AUC = 0.5: Randomly ordered

0.00 0.25 0.50 0.75 1.00 0.00 0.25 0.50 0.75 1.00

False Positive Rate True Positive Rate

c

  • Introduction to Machine Learning – 14 / 16
slide-16
SLIDE 16

AUC: AREA UNDER ROC CURVE

Interpretation: Probability that classifier ranks a random positive higher than a random negative observation

Truth Score 1 0.9 1 0.76 1 0.7 0.5 1 0.45 0.3 0.1

AUC = 0.9167

1 0.76 0.3

Choose a random positive Choose a random negative

Classifier ranks the positive higher than the negative (with probability 0.9167)

c

  • Introduction to Machine Learning – 15 / 16
slide-17
SLIDE 17

PARTIAL AUC

Sometimes it can be useful to look at a specific region under the ROC curve ⇒ partial AUC (pAUC). Examples: focus on a region with low FPR or a region with high TPR:

fpr tpr 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0

Partial AUC: 0.086

fpr tpr 0.0 0.2 0.4 0.6 0.8 1.0 0.0 0.2 0.4 0.6 0.8 1.0

Partial AUC: 0.128 c

  • Introduction to Machine Learning – 16 / 16