Linear Regression
Linear Regression
Module 4
Session 2
Learn a function
h(x), so that h(x) is
a good predictor for
the corresponding
value of y
h: hypothesis
function
How to represent hypothesis
h?
θi are parameters
- θ0 is zero condition
- θ1 is gradient
We assume y is a linear
function of x Univariate linear
regression
How to represent hypothesis
h?
θi are parameters
- θ0 is zero condition
- θ1 is gradient
We assume y is a linear
function of x Univariate linear
regression
How to learn the values of the
parameters θi?
Regression Analysis
▪ A technique for using data to identify
relationships among variables
▪ Use these relationships to make predictions.
▪ Assume that the outcome we are predicting
depends linearly on the information used to
make the prediction.
▪ Linear dependence means constant rate of
increase of one variable with respect to
another.
Parameters:
Cost Function:
Goal:
(for , this is a function
fixed of x)
500
400
Price ($)
in 1000’s
300
200
100
0 0 1000
300 2000
0 Size in feet2 (x)
Minimizing a function
Want
Outline:
• Start with some
• Keep changing to reduce
end up at a minimum
J()
If the function has multiple local minima, where one starts
can decide which minimum is reached
J()
Gradient descent
algorithm
update
simultaneousl
y
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
(for , this is a function (function of the )
fixed of x) parameters
Least Squares Estimation
▪ Suppose a sample of
▪ These observations are assumed to
satisfy the simple linear regression
model, and so we can write
▪ β
Previously:
Parameters
:
Cost
function:
Gradient
descent:
Repeat
Repeat
simultaneously fo
update r
(simultaneously )
update
New algorithm :
Gradient
Descent Repeat
Previously
(n=1):
Repeat
simultaneously fo
update r
(simultaneously )
update
Thank You