Docsity

Understanding Bayesian Learning in Machine Learning: Bayes Theorem, MAP, ML Hypotheses, an, Study notes of Computer Science

Partial preview of the text

Download Understanding Bayesian Learning in Machine Learning: Bayes Theorem, MAP, ML Hypotheses, an and more Study notes Computer Science in PDF only on Docsity!

Intro. to machine learning (CSI 5325)

Lecture 12: Bayesian learning

Greg Hamerly

Some content from Tom Mitchell.

Outline

1 Bayes Theorem

2 MAP, ML hypotheses

3 MAP learners

4 ML learners

Bayes Theorem

Bayes theorem

P(h|D) =

P(D|h)P(h) P(D)

P(h) = prior probability of hypothesis h P(D) = prior probability of training data D P(h|D) = probability of h given D P(D|h) = probability of D given h

MAP, ML hypotheses

Choosing hypotheses

Generally want most probable hypothesis given training data Maximum a posteriori hypothesis hMAP :

hMAP = argmax h∈H

P(h|D)

= argmax h∈H

P(D|h)P(h) P(D) = argmax h∈H

P(D|h)P(h)

If assume P(hi ) = P(hj ) then can further simplify, and choose the Maximum likelihood (ML) hypothesis

hML = argmax hi ∈H

P(D|hi )

MAP, ML hypotheses

Basic formulas for probabilities

Product Rule: probability P(A ∩ B) of a conjunction of two events A and B:

P(A ∩ B) = P(A|B)P(B) = P(B|A)P(A)

Sum Rule: probability of a disjunction of two events A and B:

P(A ∪ B) = P(A) + P(B) − P(A ∩ B)

Theorem of total probability: if events A 1 ,... , An are mutually exclusive with

∑n i=1 P(Ai^ ) = 1, then

P(B) =

∑^ n

i=

P(B|Ai )P(Ai )

MAP learners

Brute force MAP hypothesis learner

1 For each hypothesis h in H, calculate the posterior probability

P(h|D) =

P(D|h)P(h) P(D)

2 Output the hypothesis hMAP with the highest posterior probability hMAP = argmax h∈H

P(h|D)

MAP learners

Relation to concept learning

Assume fixed set of instances 〈x 1 ,... , xm〉 Assume D is the set of classifications D = 〈c(x 1 ),... , c(xm)〉

Choose P(D|h):

MAP learners

Relation to concept learning

Assume fixed set of instances 〈x 1 ,... , xm〉 Assume D is the set of classifications D = 〈c(x 1 ),... , c(xm)〉 Choose P(D|h) P(D|h) = 1 if h consistent with D P(D|h) = 0 otherwise Choose P(h) to be uniform distribution P(h) = (^) |H^1 | for all h in H Then,

P(h|D) =

1 |VSH,D | if^ h^ is consistent with^ D

0 otherwise

ML learners

Learning a real-valued function

With some simple assumptions, maximum likelihood learning can be converted to squared-error minimization.

Occurs often in regression (i.e. learning real-valued functions).

samples are independent true output signal is corrupted by noise noise is Gaussian with zero mean noise is i.i.d. (w.r.t. itself) noise is independent of input

ML learners

Learning a real-valued function

hML

f

e

y

x

Consider any real-valued target function f

Training examples 〈xi , di 〉, where di is noisy training value: di = f (xi ) + ei ei ∼ N(0, σ^2 ) is a random variable (noise) drawn independently for each xi according to some Gaussian distribution with μ = 0, unknown σ^2

ML learners

Learning a real-valued function

hML = argmax h∈H

p(D|h)

= argmax h∈H

∏m

i=

p(di |h)

= argmax h∈H

∏m

i=

2 πσ^2

e−^

1 2 (^

di −h(xi ) σ )^2

Maximize natural log of this instead...

ML learners

Learning a real-valued function

Maximize natural log of this instead...

hML = argmax h∈H

∑m

i=

ln

2 πσ^2

di − h(xi ) σ

= argmax h∈H

∑m

i=

di − h(xi ) σ

= argmax h∈H

∑m

i=

− (di − h(xi ))^2

= argmin h∈H

∑m

i=

(di − h(xi ))^2