LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > Homework 4

Reply
 
Thread Tools Display Modes
  #21  
Old 04-28-2013, 03:13 PM
Moobb Moobb is offline
Junior Member
 
Join Date: Apr 2013
Posts: 9
Default Re: Q4) h(x) = ax

Spent a good hour breaking my head trying to figure out where I was going wrong, finally decided to submit my best shot and can finally see what was going on!!
Thanks for the answer, somehow I was thick enough not to see what was right in front of me..
Reply With Quote
  #22  
Old 04-29-2013, 01:10 AM
vsuthichai vsuthichai is offline
Junior Member
 
Join Date: Jan 2013
Posts: 3
Default Re: Q4) h(x) = ax

Quote:
Originally Posted by Anne Paulson View Post
So, in this procedure we:

Pick two points;
Find the best slope a for those two points, the one that minimizes the squared error for those two points;
Do this N times and average all the as

Rather than:

Pick two points;
Calculate the squared error for those two points as a function of a;
Do this N times, then find the a that minimizes the sum of all of the squared errors, as we do with linear regression

Are we doing the first thing here or the second thing? Either way there's a simple analytic solution, but I'm not sure which procedure we're doing.
How do you solve for the minimum a that produces the least squared error?
Reply With Quote
  #23  
Old 04-29-2013, 01:37 AM
Ziad Hatahet Ziad Hatahet is offline
Member
 
Join Date: Apr 2013
Location: San Francisco, CA
Posts: 23
Default Re: Q4) h(x) = ax

Quote:
Originally Posted by vsuthichai View Post
How do you solve for the minimum a that produces the least squared error?
As far as I know, differentiate (ax_1-y_1)^2+(ax_2-y_2)^2 with respect to a, set it to 0, and solve for a.
Reply With Quote
  #24  
Old 04-29-2013, 01:59 AM
vsuthichai vsuthichai is offline
Junior Member
 
Join Date: Jan 2013
Posts: 3
Default Re: Q4) h(x) = ax

Thanks, i just figured that out
Reply With Quote
  #25  
Old 04-30-2013, 02:55 AM
jlevy jlevy is offline
Junior Member
 
Join Date: Apr 2013
Posts: 5
Default Re: Q4) h(x) = ax

Quote:
Originally Posted by geekoftheweek View Post
Is there a best way to minimize the mean-squared error?
Thanks
Just use w=inv(X`*X)*X`*Y
and note that X has just a single column (no column of 1's).
__________________
Joe Levy
[URL="https://trustmeimastatistician.wordpress.com/"]Trust me, I'm a statistician[/URL]
Reply With Quote
  #26  
Old 03-04-2016, 06:13 AM
khohi khohi is offline
Member
 
Join Date: Dec 2015
Posts: 10
Default Re: Q4) h(x) = ax

Great

حب الشباب
Reply With Quote
  #27  
Old 03-12-2019, 11:08 PM
vnator vnator is offline
Junior Member
 
Join Date: Mar 2019
Posts: 1
Default Re: Q4) h(x) = ax

Without using any calculus, I figured that that the best approximation for g bar(x) would be 0x, seeing as how the average of slopes between all combinations of two random points would end up as 0. In that case, why is the answer for the problem E for none of the above?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:30 PM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.