Title: 10601 Machine Learning
110601 Machine Learning
September 2, 2009
- Recitation 2
- Öznur Tastan
2Logistics
- Homework 2 is going to be out tomorrow.
- It is due on Sep 16, Wed.
- There is no class on Monday Sep 7th (Labor day)
- Those who have not return Homework 1 yet
- For details of how to submit the homework policy
please check http//www.cs.cmu.edu/ggordon/10
601/hws.html -
3Outline
- We will review
- Some probability and statistics
- Some graphical models
- We will not go over Homework 1
- Since the grace period has not ended yet.
- Solutions will be up next week on the web page.
4Well play a game Catch the goof!
- Ill be the sloppy TA will make intentional
mistakes - Youll catch those mistakes and correct me!
-
Slides with mistakes are marked with
Correct slides are marked with
5 Catch the goof!!
6Law of total probability
- Given two discrete random variables X and Y
- X takes values in
Y takes values in
7Law of total probability
- Given two discrete random variables X and Y
- X takes values in
Y takes values in
8Law of total probability
- Given two discrete random variables X and Y
- X takes values in
Y takes values in
9Law of total probability
- Given two discrete random variables X and Y
- X takes values in
Y takes values in
10Law of total probability
- Given two discrete random variables X and Y
-
Joint probability
Marginal probability
Conditional probability of X conditioned on Y
11Law of total probability
- Given two discrete random variables X and Y
-
Formulas are fine. Anything wrong with the names?
Joint probability
Marginal probability
Conditional probability of X conditioned on Y
12Law of total probability
- Given two discrete random variables X and Y
-
Joint probability of X,Y
Marginal probability
Conditional probability of X conditioned on Y
Marginal probability
13In a strange world
Two discrete random variables X and Y take binary
values
Joint probabilities
14In a strange world
Two discrete random variables X and Y take binary
values
Joint probabilities
Should sum up to 1
15The world seems fine
Two discrete random variables X and Y take binary
values
Joint probabilities
16What about the marginals?
Joint probabilities
Marginal probabilities
17This is a strange world
Joint probabilities
Marginal probabilities
18In a strange world
Joint probabilities
Marginal probabilities
19This is a strange world
Joint probabilities
Marginal probabilities
20Lets have a simple problem
Joint probabilities
Marginal probabilities
21Conditional probabilities
- What is the complementary event of P(X0Y1) ?
- P(X1Y1) OR P(X0Y0)
-
22Conditional probabilities
- What is the complementary event of P(X0Y1) ?
- P(X1Y1) OR P(X0Y0)
-
23 24Independent number of parameters
- Assume X and Y take Boolean values 0,1
- How many independent parameters do you need to
fully specify - marginal probability of X?
- the joint probability of P(X,Y)?
- the conditional probability of P(XY)?
25Independent number of parameters
- Assume X and Y take Boolean values 0,1
- How many independent parameters do you need to
fully specify - marginal probability of X?
- P(X0) 1 parameter only because
P(X1)P(X0)1 - the joint probability of P(X,Y)?
- P(X0, Y0) 3 parameters
- P(X0, Y1)
- P(X1, Y0)
- the conditional probability of P(XY)?
26Number of parameters
- Assume X and Y take Boolean values 0,1?
- How many independent parameters do you need to
fully specify - marginal probability of X?
- P(X0) 1 parameter only P(X1)
1-P(X0) - How many independent parameters do you need to
fully specify the joint probability of P(X,Y)? - P(X0, Y0) 3 parameters
- P(X0, Y1)
- P(X1, Y0)
- How many independent parameters do you need to
fully specify the conditional probability of
P(XY)? - P(X0Y0) 2 parameters
- P(X0Y1)
27Number of parameters
- What about P(X Y,Z) , how many independent
parameters - do you need to be able to fully specify the
probabilities? - Assume each RV takes
-
- m values
-
-
-
-
-
P(X Y,Z)
q values
n values
28Number of parameters
- What about P(X Y,Z) , how many independent
parameters - do you need to be able to fully specify the
probabilities? - Assume each RV takes
-
- m values
-
-
-
-
-
P(X Y,Z)
q values
n values
Number of independent parameters (m-1)nq
29Graphical models
A graphical model is a way of representing
probabilistic relationships between random
variables Variables are represented by
nodes Edges indicates probabilistic
relationships
You miss the bus
Arrive class late
30Serial connection
Is X and Z independent?
?
31Serial connection
Is X and Z independent?
X and Z are not independent
32Serial connection
Is X conditionally independent of Z given Y?
?
33Serial connection
Is X conditionally independent of Z given Y?
Yes they are independent
34How can we show it?
Is X conditionally independent of Z given Y?
35An example case
36Common cause
Age
Shoe Size
Gray Hair
X and Y are not marginally independent X and Y
are conditionally independent given Z
37Explaining away
Flu
Allergy
Z
X
Y
Sneeze
X and Z marginally independent X and Z
conditionally dependent given Y
38D-separation
- X and Z are conditionally independent given Y if
Y d-separates X and Z
Neither Y nor its descendants should be observed
Path between X and Z is blocked by Y
39D-separation example
Is B, C independent given A?
40D-separation example
Is B, C independent given A?
Yes
41D-separation example
Observed, A blocks the path
Is B, C independent given A?
Yes
42Observed, A blocks the path
Is B, C independent given A?
Yes
not observed neither its descendants
43D-separation example
Is A, F independent given E?
44Is A, F independent given E?
Yes
45Is A, F independent given E?
Yes
46Is C, D independent given F?
47Is C, D independent given F? No
48Is A, G independent given B and F?
49Is A, G independent given B and F? Yes
50Naïve Bayes Model
J
D
C
R
J The person is a junior D The person knows
calculus C The person leaves in campus R Saw
the Return of the King more than once
51Naïve Bayes Model
What parameters are stored?
J
D
C
R
J The person is a junior D The person knows
calculus C The person leaves in campus R Saw
the Return of the King more than once
52Naïve Bayes Model
P(J)
J
D
C
R
P(R/J1) P(R/J0)
P(D/J1) P(D/J0)
P(C/J1) P(C/J0)
J The person is a junior D The person knows
calculus C The person leaves in campus R Saw
the Return of the King more than once
53Naïve Bayes Model
P(J)
J
D
C
R
P(R/J1) P(R/J0)
P(D/J1) P(D/J0)
P(C/J1) P(C/J0)
J The person is a junior D The person knows
calculus C The person leaves in campus R Saw
the Return of the King more than once
54We have the structure how do we get the
CPTs?Estimate them from observed data
55Naïve Bayes Model
J The person is a junior D The person knows
calculus C The person leaves in campus R Saw
the Return of the King more than once
P(J)
J
D
C
R
P(R/J) P(R/J)
P(C/J) P(C/J)
Suppose a new person come and says I
dont know calculus I live in campus
I have seen The return of the king five
times
P(C/J) P(C/J)
What is the probability that he is a Junior?
56Naïve Bayes Model
Suppose a person says I dont know calculus
D0 I live in campus C1 I have not seen The
return of the king five times R1
J
What is the probability that he is a Junior?
P(J1/D0,C1,R1)
D
C
R
57What is the probability that he is a Junior?
J
To calculate this marginalize over J
D
C
R
58Naïve Bayes Model