Professional Documents
Culture Documents
Regression Intro Annotated PDF
Regression Intro Annotated PDF
I want to list
my house
for sale
$$ ????
Terminology:
x feature,
covariate, or
predictor
y observation or
square feet (sq.ft.) x response
6
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Predict your house by
similar houses
y
price ($)
No house sold
recently had exactly
the same sq.ft.
square feet (sq.ft.) x
7
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Predict your house by
similar houses
y
price ($)
Look at average
price in range
Still only 2 houses!
Throwing out info
square feet (sq.ft.) x from all other sales
8
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Linear regression
f(x) = w0+w1 x
parameters
square feet (sq.ft.) x of model
10
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Use a linear regression model
y Fit a line through the data
price ($)
fw (x) = w0+w1 x
function
parameterized by
square feet (sq.ft.) x w = (w0 ,w1 )
11
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Which line?
y
price ($)
fw (x) = w0+w1 x
dierent parameters w
RSS(w0,w1) =
($house 1-[w0+w1sq.ft.house 1])2
+ ($house 2-[w0+w1sq.ft.house 2])2
+ ($house 3-[w0+w1sq.ft.house 3])2
+ [include all houses]
square feet (sq.ft.) x
13
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Find best line
y Minimize cost over all
possible w0,w1
price ($)
RSS(w0,w1) =
($house 1-[w0+w1sq.ft.house 1])2
+ ($house 2-[w0+w1sq.ft.house 2])2
+ ($house 3-[w0+w1sq.ft.house 3])2
+ [include all houses]
square feet (sq.ft.) x
14
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Predicting your house price
y fw*(x) = 0 + 1 x
price ($)
You show
your friend
square feet (sq.ft.) x your analysis
Dude, its
not a linear
relationship!
square feet (sq.ft.) x
18
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
What about a quadratic function?
y
price ($)
Dude, its
not a linear
relationship!
square feet (sq.ft.) x
19
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
What about a quadratic function?
y
price ($)
fw(x) = w0 + w1 x+ w2 x2
I can
minimize
your RSS
square feet (sq.ft.) x
21
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Do you believe this fit?
y
price ($)
My house
isnt worth
so little
Minimizes RSS,
but bad predictions
fw(x) = w0 + w1 x+ w2 x2
Test error () =
($test 1-f(sq.ft.test 1))2
Assess + ($test 2-f(sq.ft.test 2))2
predictions + ($test 3-f(sq.ft.test 3))2
using + [include all
square feet (sq.ft.) x test houses]
29
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Training/Test Curves
Error
Model complexity
Only 1 bathroom!
Not same as my
3 bathrooms
x2
hard work
hard work
= 0 + 1 performance +
2 capstone + 3 forum
informed by other students who
completed specialization
37
2015
Emily
Fox
&
Carlos
Guestrin
Machine
Learning
Specializa0on
Stock prediction
Predict the price of a stock
Depends on
-Recent history of stock price
-News events
-Related commodities