Docsity

Bayesian Learning: Homework 1 Results and Maximum Likelihood Estimation, Study notes of Programming Languages

Partial preview of the text

Download Bayesian Learning: Homework 1 Results and Maximum Likelihood Estimation and more Study notes Programming Languages in PDF only on Docsity!

Bayesian Learning,

cont’d

Administrivia

• Homework 1 returned today (details in a second)

• Reading 2 assigned today

• S.^ Thrun,^ Learning occupancy grids with forward

sensor models. Autonomous Robots, 2002.

• Due:^ Oct 26

• Much^ crunchier than the first! Don’t slack.

• Work with your group to sort out the math.

• Questions to mailing list and me.

• Midterm exam:^ Oct 21

IID Samples

• In supervised learning,^ we usually assume that data

points are sampled independently and from the same distribution

• IID assumption:^ data are independent and

identically distributed

• joint^ PDF can be written as product of

individual (marginal) PDFs: f (X) = f (X 1 )f (X 2 ) · · · f (X (^) N )

=

∏^ N

i=

f (X (^) i )

The max likelihood recipe

• Start with IID data

• Assume model for individual data point,^ f ( X ;Θ)

• Construct joint likelihood function (PDF):

• Find the params^ Θ^ that maximize^ L

• (If you’re lucky):^ Differentiate^ L^ w.r.t.^ Θ,^ set^ =

and solve

• Repeat for each class

X = [X 1 , X 2 ,... , XN ]

L(Θ, X) =

∏^ N

i=

f (X (^) i ; Θ)

Solutions

• PDF for one data point:

• Joint likelihood of^ N^ data points:

∏^ N

i=

σ

2 π

e−^

(xi 2 −σμ)^2

= (σ

2 π)−N^ e−^21 σ

P (^) N i=1 (xi^ −μ)^2

L(μ, x) =

∏^ N

i=

f (xi ; μ)

f (x; μ) = 1 σ

2 π

e−^

(x− 2 σμ)^2

Solutions

• Log-likelihood:

l(μ, x) = −N ln(σ

2 π) − 1 2 σ

∑^ N

i=

(xi − μ)^2

Solutions

• Log-likelihood:

• Differentiate w.r.t.^ μ:

l(μ, x) = −N ln(σ

2 π) − 1 2 σ

∑^ N

i=

(xi − μ)^2

∂μ

l(μ, x) =^1 σ

∑^ N

i=

(xi − μ)

=^1

σ

( N

i=

xi −

∑^ N

i=

μ

Solutions

• Log-likelihood:

• Differentiate w.r.t.^ μ:

l(μ, x) = −N ln(σ

2 π) − 1 2 σ

∑^ N

i=

(xi − μ)^2

∂μ

l(μ, x) =^1 σ

∑^ N

i=

(xi − μ)

=^1

σ

( N

i=

xi −

∑^ N

i=

μ

Solutions

• What about for the gamma PDF?

f (x) = 1 3!β 3

x^2 e−^

x β

l(β, x) = −N ln(3!)( − 3 N ln(β)+

2

∑^ N

i=

ln(xi )

β

∑^ N

i=

xi

⇒ β = 1 3 N

∑^ N

i=

xi

Putting the parts together

[ X , Y ]

complete training

data

[X (^) Y =a , a]

[X (^) Y =b , b]

[X (^) Y =c , c]

Putting the parts together

[X (^) Y =a , a]

[X (^) Y =b , b]

[X (^) Y =c , c]

0.5 0 0.2 0.4 0.6 0.8 1

1.5 1

2.5 2 3

(^00) 0.2 0.4 0.6 0.8 1

1

2

0.05 (^00) 0.2 0.4 0.6 0.8 1

0.15 0.

0.25 0.

0.35 0.

X (^) q = [0. 3 , − 7 ,... , − 8 .2]

L(Θ̂ a , X (^) q ) = 0. 23

L(Θ̂ b , X (^) q ) = 0. 008

L(Θ̂ c , X (^) q ) = 1. 387

Putting the parts together

X (^) q = [0. 3 , − 7 ,... , − 8 .2]

L(Θ̂ a , X (^) q ) = 0. 23 L(Θ̂ b , X (^) q ) = 0. 008 L(Θ̂ c , X (^) q ) = 1. 387

class(X (^) q ) = arg max i

L(Θ̂ i , X (^) q ) = c

5 minutes of math...

• Recall your friend the Gaussian PDF:

• I asserted that the d-dimensional form is:

• Let’s look at the parts...

f (X) = 1 (2π) d^2 |Σ| 12

e−^

(^12) (X− X¯) T^ Σ −^1 (X− X¯)

f (x) = 1 σ

2 π

e−^

(x−μ)^2 2 σ^2

5 minutes of math...

f (X) = 1 (2π) d^2 |Σ| 12

e−^

(^12) (X− X¯) T^ Σ −^1 (X− X¯)

f (x) = 1 σ

2 π

e−^

(x−μ)^2 2 σ^2