• Tidak ada hasil yang ditemukan

Predictive Analytics Regression and Classification - Lecture 1

N/A
N/A
Protected

Academic year: 2024

Membagikan "Predictive Analytics Regression and Classification - Lecture 1"

Copied!
14
0
0

Teks penuh

(1)

Predictive Analytics Regression and Classification

Lecture 1 : Part 5

Sourish Das

Chennai Mathematical Institute

Aug-Nov, 2019

(2)

Linear Regression

mpg=β01 wt +

2 3 4 5

1015202530

wt

mpg

(3)

Linear Regression

I mpg= β01 wt+

I We write the model in terms of linear models y=Xβ+

wherey= (mpg1 ,mpg2 , . . . ,mpgn)T;

X=

 1 wt1

1 wt2

... ... 1 wtn

β= (β0, β1)T and= (1, 2, . . . , n)T

(4)

Linear Regression

I Normal Equations:

βˆ = ( ˆβ0 βˆ1)T = (XTX)−1XTy

=

n Pn i=1wti Pn

i=1wti P

i=1wt2i

−1 Pn i=1mpgi Pn

i=1wti.mpgi

(5)

Quadratic Regression

mpg=β01 hp +β2 hp2 +

50 150 250

1015202530

hp

mpg

(6)

Quadratic Regression

I mpg= β01 hp+β2 hp2 +

I We write the model in terms of linear models y=Xβ+

wherey= (mpg1 ,mpg2 , . . . ,mpgn)T;

X=

1 hp1 hp21 1 hp2 hp22 ... ... ... 1 hpn hp2n

 ,

β= (β0, β1, β2)T and= (1, 2, . . . , n)T

I The linear model is linear in parameter.

(7)

Linear Regression

I Normal Equations:

βˆ = ( ˆβ0 βˆ1 βˆ2)T

= (XTX)−1XTy

=

n Pn

i=1hpi Pn i=1hp2i Pn

i=1hpi P

i=1hp2i Pn

i=1hp3i Pn

i=1hp2i Pn

i=1hp3i Pn i=1hp4i

−1

 Pn

i=1mpgi Pn

i=1hpi.mpgi Pn

i=1hp2i.mpgi

(8)

Non-linear Regression Basis Functions

I Considerith record

yi =f(xi) +i represents f(x) as

f(x) =

K

X

j=1

βjφj(x) =φβ

we sayφis a basis system for f(x).

(9)

Representing Functions with Basis Functions

I mpg= β01 hp+β2 hp2 +

I Generic terms for curvature in linear regression y =β12x+β3x2+· · ·+i

implies

f(x) =β12x+β3x2+· · ·

I Sometimes in ML φis known as ‘engineered features’ and the process is known as ‘feature engineering’

(10)

Fourier Basis

I sine cosine functions of incresing frequencies

y =β12sin(ωx)+β3cos(ωx)+β4sin(2ωx)+β5cos(2ωx)· · ·+i

I constant ω= 2π/P defines the periodP of oscillation of the first sine/cosine pair. P is known.

I φ={1,sin(ωx),cos(ωx),sin(2ωx),cos(2ωx)...}

I βT ={β1, β2, β3,· · · }

y =φβ+

I Again in MLφis known as ‘engineered features’

I mpg= β01sin(ω hp ) +

(11)

Functional Estimation/Learning

I We are writing the function with its basis expansion

y =φβ+

I Lets assume basis (or engineered features) φarefully known.

I Problem is β is unknown - hence we estimateβ.

(12)

Regression Line

mpg=β01hp+

50 100 150 200 250 300

1015202530

hp

mpg

(13)

Feature Engineering

mpg=β01hp+β2 hp2+

50 100 150 200 250 300 350

101520253035

0 20000

40000 60000

80000 100000

120000

hp

hp2mpg

(14)

In the next lecture...

I We will discuss sampling distributions and inference of regressions !

Referensi

Dokumen terkait