Professional Documents
Culture Documents
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
different 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, it’s
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, it’s
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
isn’t worth
so little
Minimizes RSS,
but bad predictions
fw(x) = w0 + w1 x+ w2 x2
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