LFD Book Forum  

Go Back   LFD Book Forum > Book Feedback - Learning From Data > Chapter 2 - Training versus Testing

Reply
 
Thread Tools Display Modes
  #1  
Old 04-30-2012, 05:25 PM
shockwavephysics shockwavephysics is offline
Member
 
Join Date: Apr 2012
Posts: 17
Question bias and variance - definition of g bar

When considering bias and variance, the bias is defined as the squared difference between gbar and f. The lecture said that gbar is the expected value of g. The book said that one can think of this as the average of many g's returned by runnign the training algorithm on a large number of instanciations of data sets. I have two questions:

1. If g has multiple parameters, do you average the curves, or do you average the individual parameters (or does it matter)?

2. When the book says we can think of it this way, does it mean this is not the exact definition? The point of bias is to isolate the part of the error that has nothing to do with the errors caused by sample data set, or the noise in the measurement. Is there a reason why the bias is not determined by simply minimizing the squared error between the target function, f, and the form of the hypothesis set, and returning the value of that minimum. Alternatively, would it not be just as good to create a (digitized) set of all possible g's and calculate the squared error, and return the smallest error calculated. I tried this for the H=b and f=sin(pi*x) case, and I got bias=.5 .
Reply With Quote
  #2  
Old 04-30-2012, 06:17 PM
yaser's Avatar
yaser yaser is offline
Caltech
 
Join Date: Aug 2009
Location: Pasadena, California, USA
Posts: 1,477
Default Re: bias and variance - definition of g bar

Quote:
Originally Posted by shockwavephysics View Post
1. If g has multiple parameters, do you average the curves, or do you average the individual parameters (or does it matter)?
You average the value as a function of x, so 'you average the curves.'

Quote:
2. When the book says we can think of it this way, does it mean this is not the exact definition?
This would be a finite-sample estimate of \bar g that gets closer and closer to the expected value (which is the formal definition) as you use more and more data sets.
__________________
Where everyone thinks alike, no one thinks very much
Reply With Quote
  #3  
Old 04-30-2012, 06:24 PM
lucag lucag is offline
Member
 
Join Date: Apr 2012
Posts: 44
Default Re: bias and variance - definition of g bar

Quote:
Originally Posted by shockwavephysics View Post
1. If g has multiple parameters, do you average the curves, or do you average the individual parameters (or does it matter)?
I am a bit confused ... what do you mean by 'averaging the curves'? And how is this different from averaging the individual parameters?
Reply With Quote
  #4  
Old 04-30-2012, 06:32 PM
dudefromdayton dudefromdayton is offline
Invited Guest
 
Join Date: Apr 2012
Posts: 140
Default Re: bias and variance - definition of g bar

1. If your g's have a nice simple relationship, as in a polynomial, you can average your polynomials by averaging the coefficients. Distributive property. So it does matter... but you may do it either way and get the same answer.

2. I'm not quite connecting the question (LONG DAY) and leave it available for another to jump on.
Reply With Quote
  #5  
Old 04-30-2012, 08:23 PM
lucag lucag is offline
Member
 
Join Date: Apr 2012
Posts: 44
Default Re: bias and variance - definition of g bar

Quote:
Originally Posted by dudefromdayton View Post
1. If your g's have a nice simple relationship, as in a polynomial, you can average your polynomials by averaging the coefficients. Distributive property. So it does matter... but you may do it either way and get the same answer.
Oh I see ... for some reasons, I was assuming the expansion being made on a basis of the Hilbert space.
Thanks, that clarifies!
Reply With Quote
  #6  
Old 04-30-2012, 09:46 PM
holland holland is offline
Junior Member
 
Join Date: Apr 2012
Posts: 3
Default Re: bias and variance - definition of g bar

I have another, sort-of related question about gbar.

The lecture and text implied that gbar doesn't depend on the data set (since it's the expected value over all data sets), but I get different answers for gbar (with different resulting values for the bias) if I minimize the squared error over a thousand data points and average several of those, vs. minimizing the squared error over 2 data points a couple million times.

Does this mean I must be doing something wrong? Or is it expected that the size of your data sets can correctly give you different gbars, even though it doesn't depend on a data set?
Reply With Quote
  #7  
Old 04-30-2012, 10:16 PM
yaser's Avatar
yaser yaser is offline
Caltech
 
Join Date: Aug 2009
Location: Pasadena, California, USA
Posts: 1,477
Default Re: bias and variance - definition of g bar

Quote:
Originally Posted by holland View Post
The lecture and text implied that gbar doesn't depend on the data set
Correct, but it can depend on the size of the data set (N).
__________________
Where everyone thinks alike, no one thinks very much
Reply With Quote
  #8  
Old 08-05-2012, 03:48 PM
the cyclist the cyclist is offline
Member
 
Join Date: Jul 2012
Posts: 26
Default Re: bias and variance - definition of g bar

I am struggling to replicate the variance of H_1 of Ex. 2.8 in the text. I was able to get the bias correct (and both bias and variance for H_0), as well as getting the related quiz problem correct, so this is really puzzling me.

I'm trying to narrow down where my mistake might be. Can someone please verify whether or not the correct average hypothesis is

g_bar(x) = a_mean * x + b_mean

where

a_mean ~= 0.776

and

b_mean ~= 0.

I plot that, and it does look like the figure in the book.

Also, when I take the standard deviation (over the data sets) of the coefficients a and b, I get

std(a) ~= 1.52
std(b) ~= 0.96

Do those look right? I am truly puzzled here!
Reply With Quote
  #9  
Old 08-05-2012, 09:58 PM
munchkin munchkin is offline
Member
 
Join Date: Jul 2012
Posts: 38
Default Re: bias and variance - definition of g bar

Examination of the two charts for hypothesis H1 in the book brings up an interesting point that may be helpful. The top chart shows various lines (g's) plotted on the graph. Each line is the result of taking two randomly selected points in the x axis, evaluating them to get the y value and then putting a line thru the two points. Those points will always be on the sinusoid but the lines (the g's) representing the associated function g(x) do not have to be. Notice the two outlying lines in the upper left corner of the top chart. They are totally off of the sinusoid but if g(x) - gbar(x) was to be evaluated in that corner then the value of the outlier g's at that x value (close to -1) must be included in the determination of gbar(x). The only way to get those values is to calculate the y value of each associated line at that point.
Reply With Quote
  #10  
Old 08-06-2012, 05:17 AM
the cyclist the cyclist is offline
Member
 
Join Date: Jul 2012
Posts: 26
Default Re: bias and variance - definition of g bar

I think my individual hypothesis lines are all correct. I have checked that they all go through the two points.
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 10:55 AM.


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.