Module 07
Module 07
Sourish Das
10 15 20 25 30
mpg
2 3 4 5
wt
Linear Regression
I mpg = β0 + β1 wt +
I We write the model in terms of linear models
y = Xβ +
I Normal Equations:
35
30
25
mpg
disp
500
20
400
300
15
200
100
10
0
1 2 3 4 5 6
wt
Regression Plane
y = Xβ +
I Normal Equations:
I Ask yourself.
Linear Plane
I Normal Equations:
10 15 20 25 30
mpg
50 150 250
hp
Feature Engineering
mpg=β0 +β1 hp+β2 hp2 +
35
30
25
hp2
mpg
120000
100000
20
80000
60000
15
40000
20000
10
0
50 100 150 200 250 300 350
hp
Quadratic Regression
I mpg = β0 + β1 hp + β2 hp2 +
I We write the model in terms of linear models
y = Xβ +
1 hp1 hp21
1 hp2 hp2
2
X = . .. ,
. ..
. . .
1 hpn hp2n
I Normal Equations:
35
30
25
mpg
hp^2
500
20
400
300
15
200
100
10
0
1 2 3 4 5 6
hp
Feature Engineering/ Variable Transformation
I Consider i th record
yi = f (x i ) + i , i = 1, 2, · · · , n
represents f (x) as
K
X
f (x) = βj φj (x) = φβ
j=1
I mpg = β0 + β1 hp + β2 hp2 +
y = β1 + β2 x + β3 x 2 + · · · + i
implies
f (x) = β1 + β2 x + β3 x 2 + · · ·
I Sometimes in ML φ is known as ‘engineered features’
and the process is known as ‘feature engineering’
Fourier Basis
I sine cosine functions of incresing frequencies
y = φβ +
I Again in ML φ is known as ‘engineered features’
I mpg = β0 + β1 sin(ω hp ) +
Functional Estimation/Learning
y = φβ +
I Lets assume basis (or engineered features) φ are fully
known.
y = φβ +
I Lets assume basis (or engineered features) φ are fully
known.
I OLS Estimator:
β̂ = (φT φ)−1 φT y
Uncertainty associated with the OLS estimator
ŷ = φ(x0 )β̂