LFD Book Forum (http://book.caltech.edu/bookforum/index.php)
-   Homework 4 (http://book.caltech.edu/bookforum/forumdisplay.php?f=133)

 silvrous 04-30-2012 02:40 AM

Hw4 q4

What is the range of a? [-1,1] of [-INF, +INF] ?

 kkkkk 04-30-2012 04:04 AM

Re: Hw4 q4

From my testing, a is within +/- pi.
This follows from the max/min gradient of sin(pi.x) = pi . cos(pi . x)
It is ok to use a larger range, just that the program will run slower.

 silvrous 04-30-2012 08:50 AM

Re: Hw4 q4

Thanks, but now I think I've hit another snag. Is the bias in class surely 0.21? My calculation shows it as exactly 0.31...

 Tyler 04-30-2012 09:27 AM

Re: Hw4 q4

I can't help with that but I have a more basic question. To get ax on two points, do we take the "a" based on the average of the two points

(y1+y2)/(x1+x2)
-or-

calculate "a" on each point and take the average?
1/2 (y1/x1 + y2/x2)

 silvrous 04-30-2012 11:22 AM

Re: Hw4 q4

The two give very different results, but shouldn't they be equivalent in grading?

 yaser 04-30-2012 11:30 AM

Re: Hw4 q4

Quote:
 Originally Posted by Tyler (Post 1679) I can't help with that but I have a more basic question. To get ax on two points, do we take the "a" based on the average of the two points (y1+y2)/(x1+x2) -or- calculate "a" on each point and take the average? 1/2 (y1/x1 + y2/x2)
Choose the value of that minimizes the average mean-squared error on the two points.

 jmknapp 04-30-2012 11:44 AM

Re: Hw4 q4

I don't think (y1+y2)/(x1+x2) is valid, i.e., not the best choice for the line a*x. Maybe 1/2*(y1/x1 + y2/x2) is close but is it correct?

Seems like the way to go is to get a formula for the distance function (squared distance) and then minimize it. The answer from that process differs from 1/2*(y1/x1 + y2/x2).

EDIT: Prof. Mostafa posted while I was checking that result.

 kurts 04-30-2012 04:27 PM

Re: Hw4 q4

Quote:
 Is the bias in class surely 0.21?
In class, the hypothesis that resulted in a bias of 0.21 was of the form ax+b, where the line was free to be offset from the origin. In this problem, b is restricted to be 0, so one would expect the bias to be different.

 kkkkk 04-30-2012 09:44 PM

Re: Hw4 q4

Quote:
 Originally Posted by kurts (Post 1688) In class, the hypothesis that resulted in a bias of 0.21 was of the form ax+b, where the line was free to be offset from the origin. In this problem, b is restricted to be 0, so one would expect the bias to be different.
In Lecture 8 slide 15, for y=ax+b, g_bar passes through the origin even though it is not forced to. This is reasonable due to the 'symmetry' of the curve.

 All times are GMT -7. The time now is 09:09 AM.