LFD Book Forum

LFD Book Forum (http://book.caltech.edu/bookforum/index.php)
-   Homework 4 (http://book.caltech.edu/bookforum/forumdisplay.php?f=133)
-   -   Q4) h(x) = ax (http://book.caltech.edu/bookforum/showthread.php?t=959)

Moobb 04-28-2013 03:13 PM

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!! :eek:
Thanks for the answer, somehow I was thick enough not to see what was right in front of me..

vsuthichai 04-29-2013 01:10 AM

Re: Q4) h(x) = ax
 
Quote:

Originally Posted by Anne Paulson (Post 9109)
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?

Ziad Hatahet 04-29-2013 01:37 AM

Re: Q4) h(x) = ax
 
Quote:

Originally Posted by vsuthichai (Post 10637)
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.

vsuthichai 04-29-2013 01:59 AM

Re: Q4) h(x) = ax
 
Thanks, i just figured that out

jlevy 04-30-2013 02:55 AM

Re: Q4) h(x) = ax
 
Quote:

Originally Posted by geekoftheweek (Post 9081)
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).

khohi 03-04-2016 06:13 AM

Re: Q4) h(x) = ax
 
Great :)

حب الشباب

vnator 03-12-2019 11:08 PM

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?


All times are GMT -7. The time now is 06:36 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, 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.