You are on page 1of 12

Instructions: Create any confusion matrix by inputting values for cells labelle

Confusion Matrix

Condition X "+" 0.2 a


[defective computer chip]
"-" 0.8 b

Individual Probabilities Name


P("+") a Incidence of Condition "+"
p("-") b Incidence of "Condition "-"
p(Test POS) c Classification Incidence "POS"
p(Test NEG) d Classification Incidence "NEG"
p(Test POS, "+") e True Positives
p(Test NEG, "+") f False Negatives
p(Test "POS, "-") g False Positives
p(Test "NEG", "-") h True Negatives

Probability Distributions
P(X) p(a,b)
P(Y) p(c,d)
p(X,Y) p(e,f,g,h)
P(X)p(Y) p(ac,ad,bc,bd)

Definition of Independence P(X,Y) = P(X)p(Y)


X, Y Independent or Dependent?
Dependent

Conditional Probabilities
p(Test POS | "+") e/a 0.50
p(Test NEG | "+") f/a 0.50
p(Test POS | "-") g/b 0.25
p(Test NEG | "-") h/b 0.75

p("+" | Test POS) e/c 0.33


p( "-" | Test POS) g/c 0.67
p("+" | Test NEG) f/d 0.14
p("-" | Test NEG) h/d 0.86

"Relative Entropy" of p and q, written D(p||q)


is the summation of all p(i)*log(p(i)/qIi)
It is also called "Kullback-Leibler Divergence" (or "KL Divergence" for sh
The Relative Entropy of the Joint distribution p [row 28] and the produ
[Note that this definition is not required for Course - advanced topic]
tting values for cells labelled a, c, and e.

Test Classification Y
[optical scanner on assembly line]
"Positive" "Negative"
0.3 c 0.7 d

0.1 e 0.1 f

0.2 g 0.6 h

ence of Condition "+" H(X)


ence of "Condition "-" 0.7219
fication Incidence "POS"
fication Incidence "NEG"
H(Y)
Negatives 0.8813
Positives
Negatives

Name H(X,Y)
Probability of the Condition 1.5710
Probability of the Classification
Joint Distribution of X and Y 0.1
Product Distribution of X and Y 0.06
Mutual Information I(X:Y) = Rela
= e*log(e/ac)
Name 0.0323
True Positive Rate
False Negative Rate
False Positive Rate H(Y|X)
True Negative Rate
0.8490
Positive Predictive Value (PPV)
1- PPV
1- NPV H(X|Y)
Negative Predictive Value (NPV)
0.6897

(or "KL Divergence" for short)


p [row 28] and the product distribution q [row 29] is the mutual information [cell L35]
Course - advanced topic]
The spreadsheet outputs entropy (information) measures for all relevant distributions

Percentage Information Gain (P.I.G.)


A correlation measure defined as mutual information between X and Y
divided by the entropy of the Condition X
I(X;Y) 0.0323 bits
divided by
H(X) 0.7219 bits
equals
4.47%
Average reduction in uncertainty of one outcome in X upon learning on

= a*log(1/a) + b*log(1/b) I(X;Y) = H(X)


0.4644 0.2575 0.0323 0.7219

I(X;Y) = H(Y)
= c*log(1/c) + d*log(1/d) 0.0323 0.8813
0.5211 0.3602
I(X;Y) = H(X)
0.0323 0.7219

= e*log(1/e) + f*log(1/f) + g*Log(1/g) + h*log(1/h)


0.3322 0.3322 0.4644 0.4422

e 0.10 f 0.20 g
ac 0.14 ad 0.24 bc
Information I(X:Y) = Relative Entropy of Joint and Product Distributions --- D(p(X,Y||p(X)p(Y))
0.0736965594 + f*log(f/ad) -0.04854268272 + g*log(g/bc) -0.05261

= (a *H(e/a, f/a)) + (b *H(g/b, h/b)


0.2000 1.0000 0.8000 0.8113

= (c *H(e/c, g/c) + (d *H(f/d, h/d)


0.3000 0.9183 0.7000 0.5917

mation [cell L35]


relevant distributions.

tion between X and Y

e in X upon learning one outcome in Y

- H(X|Y)
0.6897

- H(Y|X)
0.8490

+ H(Y) - H(X,Y)
0.8813 1.5710

0.60 h
0.56 bd
- D(p(X,Y||p(X)p(Y))
+ h*log(h/bd) 0.059721

H(g/b, h/b)

H(f/d, h/d)
Copyright Daniel Egger/ Attribution 4.0 Inter
Venn diagram courtesy of Konrad Voelkel - Wikipedia: https://en.
ribution 4.0 International (CC BY 4.0)
l - Wikipedia: https://en.wikipedia.org/wiki/Information_diagram

You might also like