Bayesian Regression: Nonlinear Inputs & Probabilistic Approach by Chuck Anderson - Prof. C, Study notes of Computer Science

A derivation of bayesian regression for linear models with nonlinear inputs and probabilistic approach. The bayes theorem, gaussian likelihood function, and calculation of mean and covariance matrix of the distribution of weights. It also includes an application to auto mpg data and 1-d data.

Typology: Study notes

Pre 2010

Uploaded on 11/08/2009

koofers-user-san
koofers-user-san 🇺🇸

10 documents

1 / 38

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS545: Linear
Models (Nonlinear
Inputs;
Probabilistic)
Chuck Anderson
Bayesian
Regression
Derivation
Application to Auto
MPG Data
Application to 1-D
Data
CS545: Linear Models (Nonlinear Inputs;
Probabilistic)
Chuck Anderson
Department of Computer Science
Colorado State University
Fall, 2009
1 / 39
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26

Partial preview of the text

Download Bayesian Regression: Nonlinear Inputs & Probabilistic Approach by Chuck Anderson - Prof. C and more Study notes Computer Science in PDF only on Docsity!

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

CS545: Linear Models (Nonlinear Inputs;

Probabilistic)

Chuck Anderson

Department of Computer Science Colorado State University

Fall, 2009

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Outline

Bayesian Regression Derivation Application to Auto MPG Data Application to 1-D Data

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Bayesian Regression

The full Bayesian approach to regression does not solve for a single w value. Instead, an expression for the probability of a model, given the data, is formulated. Then, a sum is taken over all possible models of the prediction value for a given model weighted by the probability of that model. So p(tn|xn, X, T) =

p(tn, model|xn, X, T) dmodel

=

p(tn|model, xn, X, T) p(model|X, T) dmodel

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Bayesian Regression

The full Bayesian approach to regression does not solve for a single w value. Instead, an expression for the probability of a model, given the data, is formulated. Then, a sum is taken over all possible models of the prediction value for a given model weighted by the probability of that model. So p(tn|xn, X, T) =

p(tn, model|xn, X, T) dmodel

=

p(tn|model, xn, X, T) p(model|X, T) dmodel

As before, let’s choose the model to be y (xn, w) = φ(xn)w + , where  ∼ N (0, β−^1 ). With this choice p(tn|model, xn, X, T) = p(tn|w, φ, xn, X, T, β) = N (tn|φ(xn)w, β−^1 )

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Bayes Theorem tells us

p(model|X, T) ∝ p(T|X, model)p(model)

or

p(w|φ, X, T, β) ∝ p(T|w, φ, X, β)p(w)

We will model the data likelihood function as a Gaussian,

p(T|w, φ, X, β) = N (T|Φw, β−^1 I )

=

∏^ N

n=

N (tn|φ(xn)w, β−^1 )

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Bayes Theorem tells us

p(model|X, T) ∝ p(T|X, model)p(model)

or

p(w|φ, X, T, β) ∝ p(T|w, φ, X, β)p(w)

We will model the data likelihood function as a Gaussian,

p(T|w, φ, X, β) = N (T|Φw, β−^1 I )

=

∏^ N

n=

N (tn|φ(xn)w, β−^1 )

Again, choose the prior distribution of the weights to be the zero-mean Gaussian

p(w|α) = N (w| 0 , α−^1 I )

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Now the original equation becomes

p(tn|xn, X, T) = ∫ N (tn|φ(xn)w, β−^1 )

∏^ N

n=

N (tn|φ(xn)w, β−^1 )

N (w| 0 , α−^1 I )dw

Let’s work on the last two terms in the integral. They involve products of Gaussians, which involve products of exponential terms with base e. These products are formed by adding the exponents, so let’s focus on the value of the exponent of e. The sum we get is

∑^ N

n=

(tn−φ(xn)w)^2 + wT^ αI w)

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Continuing working with the sum, we get

− 12 (β

X^ N n=

(tn − φ(xn)w)^2 + wT^ αI w)

= − 12 β

X^ N n=

t n^2 +

X^ N n=

tnφ(xn)w − 12 (

X^ N n=

φ(xn)w )^2 − 12 wT^ αI w

= − 12 βTT^ T + βTT^ Φw − 12 βwT^ ΦT^ Φw − 12 wT^ αI w

= − 12 wT^ (βΦT^ Φ + αI )w + wT^ βΦT^ T − 12 βTT^ T

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Reverse engineering a Gaussian

Look at expression (2.71) in Bishop’s book and the text around it.

(x − μ)T^ Σ−^1 (x − μ) =

xT^ Σ−^1 x + xT^ Σ−^1 μ + const

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Reverse engineering a Gaussian

Look at expression (2.71) in Bishop’s book and the text around it.

(x − μ)T^ Σ−^1 (x − μ) =

xT^ Σ−^1 x + xT^ Σ−^1 μ + const

Comparing with our previous expression

wT^ (βΦT^ Φ + αI )w + wT^ βΦT^ T −

βTT^ T

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Unfortunately, with this definition, the linear terms do not match. To make them match, we can introduce Σ−^1 Σ = I at the right place, so

wT^ βΦT^ T becomes wT^ Σ−^1 ΣβΦT^ T

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Unfortunately, with this definition, the linear terms do not match. To make them match, we can introduce Σ−^1 Σ = I at the right place, so

wT^ βΦT^ T becomes wT^ Σ−^1 ΣβΦT^ T

making the full exponent

wT^ (βΦT^ Φ + αI )w+

wT^ (βΦT^ Φ + αI )(βΦT^ Φ + αI )−^1 βΦT^ T− 1 2

βTT^ T

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Renaming the mean and covariance matrix of this distribution of w to be

Sw = Σ = (βΦT^ Φ + αI )−^1 μw = μ = βSw ΦT^ T,

Models (NonlinearInputs; Probabilistic) Chuck Anderson Bayesian Regression DerivationApplication to Auto MPG Data Application to 1-DData

Renaming the mean and covariance matrix of this distribution of w to be

Sw = Σ = (βΦT^ Φ + αI )−^1 μw = μ = βSw ΦT^ T,

We have now identified the resulting Gaussian to be

N (μw , Sw ).

Our book uses variable names μN and SN for μw and Sw.