Docsity

Least-Squares Data Fitting - Matrix Computation - Lecture Slides, Slides of Advanced Computer Architecture

Toggle sidebar
bg1
Least-squares data fitting
we are given:
•functions f1, . . . , fn:S→R, called regressors or basis functions
•data or measurements (si, gi),i= 1, . . . , m, where si∈Sand (usually)
m≫n
problem: find coefficients x1, . . . , xn∈Rso that
x1f1(si) + · · · +xnfn(si)≈gi, i = 1, . . . , m
i.e., find linear combination of functions that fits data
least-squares fit: choose xto minimize total square fitting error:
m
X
i=1
(x1f1(si) + · · · +xnfn(si)−gi)2
Least-squares applications 6–2
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Least-Squares Data Fitting - Matrix Computation - Lecture Slides and more Slides Advanced Computer Architecture in PDF only on Docsity!

Least-squares data fitting

we are given:

functions

f

1

,... , f

n

S

R

, called

regressors

or

basis functions

data

or

measurements

s

i

, g

i

i

,... , m

, where

s

i

S

and (usually)

m

n

problem:

find coefficients

x

1

,... , x

n

R

so that

x

1

f

1

s

i

x

n

f

n

s

i

g

i

i

,... , m

i.e.

, find linear combination of functions that fits data

least-squares fit:

choose

x

to minimize total square fitting error:

m

i

=

x

1

f

1

s

i

x

n

f

n

s

i

g

i

2

Least-squares applications

6–

using matrix notation, total square fitting error is

Ax

g

2

, where

A

ij

f

j

s

i

hence, least-squares fit is given by

x

A

T

A

−

1

A

T

g

(assuming

A

is skinny, full rank)

corresponding function is

f

lsfit

s

x

1

f

1

s

x

n

f

n

s

applications: –

interpolation, extrapolation, smoothing of data

developing simple, approximate model of data

Least-squares applications

6–

assuming

t

k

t

l

for

k

l

and

m

n

A

is full rank:

suppose

Aa

corresponding polynomial

p

t

a

0

a

n

−

1

t

n

−

1

vanishes at

m

points

t

1

,... , t

m

by fundamental theorem of algebra

p

can have no more than

n

zeros, so

p

is identically zero, and

a

columns of

A

are independent,

i.e.

A

full rank

Least-squares applications

6–

Example

fit

g

t

t/

t

2

with polynomial

m

points between

t

t

least-squares fit for degrees

have RMS errors

, respectively

Least-squares applications

6–

Docsity.com

Growing sets of regressors

consider

family

of least-squares problems

minimize

p i

=

x

i

a

i

y

for

p

,... , n

a

1

,... , a

p

are called

regressors

approximate

y

by linear combination of

a

1

,... , a

p

project

y

onto

span

a

1

,... , a

p

regress

y

on

a

1

,... , a

p

as

p

increases, get better fit, so optimal residual decreases

Least-squares applications

6–

solution for each

p

n

is given by

x

(

p

)

ls

A

Tp

A

p

−

1

A

Tp

y

R

−

1

p

Q

Tp

y

where

A

p

= [

a

1

a

p

]

R

m

×

p

is the first

p

columns of

A

A

p

Q

p

R

p

is the

QR

factorization of

A

p

R

p

R

p

×

p

is the leading

p

×

p

submatrix of

R

Q

p

= [

q

1

q

p

]

is the first

p

columns of

Q

Least-squares applications

6–

Least-squares system identification

we measure input

u

t

and output

y

t

for

t

,... , N

of unknown system

u

t

y

t

unknown system

system identification problem:

find reasonable model for system based

on measured I/O data

u

y

example with scalar

u

y

(vector

u

y

readily handled): fit I/O data with

moving-average (MA) model with

n

delays

y

t

h

0

u

t

h

1

u

t

h

n

u

t

n

where

h

0

,... , h

n

R

Least-squares applications

6–

we can write model or predicted output as

y

n

y

n

y

N

u

n

u

n

u

u

n

u

n

u

u

N

u

N

u

N

n

h

0

h

1

h

n

model prediction error

is

e

y

n

y

n

,... , y

N

y

N

least-squares identification:

choose model (

i.e.

h

) that minimizes norm

of model prediction error

e

... a least-squares problem (with variables

h

Least-squares applications

6–

0

10

20

30

40

50

60

70

−1 −2 −3 −

5 4 3 2 1 0

t

solid:

y

(

t

)

: actual output

dashed:

ˆ y

(

t

)

, predicted from model

Least-squares applications

6–

Model order selection

question:

how large should

n

be?

obviously the larger

n

, the smaller the prediction error

on the data used

to form the model

suggests using largest possible model order for smallest prediction error

Least-squares applications

6–

Out of sample validation

evaluate model predictive performance on another I/O data set

not used to

develop model model validation data set:

0

10

20

30

40

50

60

70

−2 −

4 2 0

0

10

20

30

40

50

60

70

−

5 0

)t( ¯y

t t

)t( ¯u

Least-squares applications

6–

now check prediction error of models (developed using

modeling data

) on

validation data:

0

5

10

15

20

25

30

35

40

45

50

0

0.8 0.6 0.4 0.

1

n

relative prediction error

validation datamodeling data

plot suggests

n

is a good choice

Least-squares applications

6–

Growing sets of measurements

least-squares problem in ‘row’ form:

minimize

Ax

y

2

m

i

=

a

Ti

x

y

i

2

where

˜a

Ti

are the rows of

A

˜a

i

R

n

x

R

n

is some vector to be estimated

each pair

a

i

y

i

corresponds to one measurement

solution is

x

ls

m

i

=

a

i

˜a

Ti

−

1

m

i

=

y

i

˜a

i

suppose that

˜a

i

and

y

i

become available sequentially,

i.e.

m

increases

with time

Least-squares applications

6–

Recursive least-squares

we can compute

x

ls

m

m

i

=

˜a

i

a

Ti

−

1

m

i

=

y

i

˜a

i

recursively

initialize

P

R

n

×

n

q

R

n

for

m

P

m

P

m

a

m

a

Tm

q

m

q

m

y

m

˜a

m

if

P

m

is invertible, we have

x

ls

m

P

m

−

1

q

m

P

m

is invertible

˜a

1

˜a

m

span

R

n

(so, once

P

m

becomes invertible, it stays invertible)

Least-squares applications

6–