CSE445 T3b Linear Regression Multiple Varable
CSE445 T3b Linear Regression Multiple Varable
Linear Regression
with Multiple Variable
• Notation
• n = number of features
• m = number of training examples
• x(i) = input (features) of ith training example
• 𝒙𝒊𝒋 = value of features j in ith training example
E.g.:
hθ(x) = 80 + 0.1x1 + 0.01x2 + 3x3 - 2x4
1
Cost function: 𝐽(θ) = σ𝑚 (ℎ
𝑖=1 θ (𝑥 (𝑖) ) − 𝑦 (𝑖) )2
2𝑚
Gradient descent:
Repeat{
θj ≔ θj – α 𝜕𝜕θ J(θ)
j
} (simultaneously update for every j = 0, 1, … n)
θ1 ≔ θ1 – α 𝑚1 σ𝑚 (𝑖) (𝑖)
𝑖=1(ℎθ(𝑥 ) − 𝑦 ) 𝑥
(𝑖)
0 ≤ x1 ≤ 1 θ2
J(θ)
0 ≤ x2 ≤ 1
• If you define each value from
x1 and x2 by dividing by the
max for each feature
• Contours become more like
circles (as scaled between θ1
0 and 1)
x0 = 0
0 ≤ x1 ≤ 3
-2 ≤ x2 ≤ 0.5
-100 ≤ x3 ≤ 100
-0.0001 ≤ x4 ≤ 0.0001
No of iteration
• Two features
• Frontage - width of the plot of land along road (x1)
• Depth - depth away from road (x2)