













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Greg Hamerly
Some content from Tom Mitchell.
Outline
1 Learning to predict probabilities
2 Minimum description length principle
3 Bayes optimal classifier
4 Naive Bayes learner
Learning to predict probabilities
In this case we can show that
hML = argmax h∈H
∏m i=
P(di |xi , h)P(xi )
= argmax h∈H
∏m i=
P(di |xi , h)
= argmax h∈H
∏m i=
h(xi )di^ (1 − h(xi ))^1 −di
= argmax h∈H
∑m i=
di ln h(xi ) + (1 − di ) ln(1 − h(xi ))
This ‘error’ function is known as ‘cross-entropy.’
Learning to predict probabilities
hML = argmax h∈H
∑m i=
di ln h(xi ) + (1 − di ) ln(1 − h(xi ))
Weight update rule for a sigmoid unit: wjk ← wjk + ∆wjk , where
∆wjk = η
∑^ m i=
(di − h(xi )) xijk
Minimum description length principle
Example: H = decision trees, D = training data labels LC 1 (h) is # bits to describe tree h LC 2 (D|h) is # bits to describe D given h → Note LC 2 (D|h) = 0 if examples classified perfectly by h. → Only need to explicitly encode exceptions to the hypothesis. Hence hMDL trades off tree size for training errors
Minimum description length principle
Re-work the MAP hypothesis definition using log: hMAP = argmax h∈H
P(D|h)P(h) = argmax h∈H
(log 2 P(D|h) + log 2 P(h)) = argmin h∈H
(− log 2 P(D|h) − log 2 P(h))
Bayes optimal classifier
The Bayes optimal classifier is a classifier that: uses every possible hypothesis in H uses the probability of each hypothesis
Bayes optimal classification: The probability of class vj ∈ V given data D is:
P(vj |D) =
hi ∈H
P(vj |hi )P(hi |D)
Thus, the most likely class is vBayesOpt = argmax vj ∈V
hi ∈H
P(vj |hi )P(hi |D)
Bayes optimal classifier
Example: P(h 1 |D) =. 4 , P(−|h 1 ) = 0, P(+|h 1 ) = 1 P(h 2 |D) =. 3 , P(−|h 2 ) = 1, P(+|h 2 ) = 0 P(h 3 |D) =. 3 , P(−|h 3 ) = 1, P(+|h 3 ) = 0 therefore, ∑ hi ∈H
P(+|hi )P(hi |D) =. 4 ∑ hi ∈H
P(−|hi )P(hi |D) =. 6
and argmax vj ∈V
hi ∈H
P(vj |hi )P(hi |D) = −
Bayes optimal classifier
Both error rates are of interest! Why?
Bayes rate: gives the best possible error rate of any classifier over the distribution of all examples for the chosen hypothesis space If we know the Bayes rate, we may know when to stop training!
The base rate gives the best error for the simplest strategy. If a classifier is not doing better than the base rate, then it may not be worth using! Of course, consider the cost of making mistakes. For example, a rare cancer that occurs in only .2% of people. Use the base rate in your experimental analysis!
Bayes optimal classifier
Bayes optimal classifier provides best result, but can be expensive if there are many hypotheses.
Gibbs algorithm: 1 Choose one hypothesis at random, according to P(h|D) 2 Use this to classify new instance Surprising fact: Assume target concepts are drawn at random from H according to priors on H. Then: E [errorGibbs ] ≤ 2 E [errorBayesOptimal ] Suppose correct, uniform prior distribution over H, then Pick any hypothesis from VS, with uniform probability Its expected error no worse than twice Bayes optimal
Naive Bayes learner
Assume target function f : X → V , where each instance x described by attributes 〈a 1 , a 2... an〉.
Most probable value of f (x) is: vMAP = argmax vj ∈V
P(vj |a 1 , a 2... an)
= argmax vj ∈V
P(a 1 , a 2... an|vj )P(vj ) P(a 1 , a 2... an) = argmax vj ∈V
P(a 1 , a 2... an|vj )P(vj )
Naive Bayes learner
vMAP = argmax vj ∈V
P(a 1 , a 2... an|vj )P(vj )
Naive Bayes assumption (what does this mean?):
P(a 1 , a 2... an|vj ) =
i
P(ai |vj )
which gives the Naive Bayes classifier:
vNB = argmax vj ∈V
P(vj )
i
P(ai |vj )
Naive Bayes learner
Consider PlayTennis again, and new instance 〈Outlook = sun, Temp = cool, Humid = high, Wind = strong 〉
Want to compute: vNB = argmax vj ∈V
P(vj )
i
P(ai |vj )
P(y ) P(sun|y ) P(cool|y ) P(high|y ) P(strong |y ) =. 005 P(n) P(sun|n) P(cool|n) P(high|n) P(strong |n) =. 021
→ vNB = n
Naive Bayes learner
Conditional independence assumption is often violated
P(a 1 , a 2... an|vj ) =
i
P(ai |vj )
...but it works surprisingly well anyway. Note don’t need estimated posteriors Pˆ(vj |x) to be correct; need only that
argmax vj ∈V
P^ ˆ(vj )
i
P^ ˆ(ai |vj ) = argmax vj ∈V
P(vj )P(a 1... , an|vj )
see [Domingos & Pazzani, 1996] for analysis Naive Bayes posteriors often unrealistically close to 1 or 0