LFD Book Forum  

Go Back   LFD Book Forum > Book Feedback - Learning From Data > Chapter 3 - The Linear Model

Reply
 
Thread Tools Display Modes
  #1  
Old 05-30-2014, 05:21 AM
tomaci_necmi tomaci_necmi is offline
Junior Member
 
Join Date: May 2014
Posts: 3
Default Exercise 3.4

I asked the question at math stack exchange,

http://math.stackexchange.com/questi...to-a-dataset-d


Can anyone explain me how it works ?
Reply With Quote
  #2  
Old 05-30-2014, 05:22 AM
tomaci_necmi tomaci_necmi is offline
Junior Member
 
Join Date: May 2014
Posts: 3
Default Re: Exercise 3.4

In my textbook, there is a statement mentioned on the topic of linear regression/machine learning, and a question, which is simply quoted as,

Consider a noisy target, y = (w^{*})^T \textbf{x} + \epsilon, for generating the data, where \epsilon is a noise term with zero mean and \sigma^2 variance, independently generated for every example (\textbf{x},y). The expected error of the best possible linear fit to this target is thus \sigma^2.

For the data D =  \{ (\textbf{x}_1,y_1), ..., (\textbf{x}_N,y_N)  \}, denote the noise in y_nas \epsilon_n, and let \mathbf{\epsilon}   = [\epsilon_1, \epsilon_2, ...\epsilon_N]^T; assume that X^TX is invertible. By following the steps below, ***show that the expected in-sample error of linear regression with respect to D is given by***,

\mathbb{E}_D[E_{in}( \textbf{w}_{lin} )] = \sigma^2 (1 - \frac{d+1}{N})


Below is my methodology,


Book says that,

In-sample error vector, \hat{\textbf{y}} - \textbf{y}, can be expressed as (H-I)\epsilon, which is simply, hat matrix, H= X(X^TX)^{-1}X^T, times, error vector, \epsilon.

So, I calculated in-sample error, E_{in}( \textbf{w}_{lin} ), as,

E_{in}( \textbf{w}_{lin} ) = \frac{1}{N}(\hat{\textbf{y}} - \textbf{y})^T (\hat{\textbf{y}} - \textbf{y}) =  \frac{1}{N}  (\epsilon^T (H-I)^T (H-I) \epsilon)

Since it is given by the book that,

(I-H)^K = (I-H), and also (I-H) is symetric, trace(H) = d+1

I got the following simplified expression,

E_{in}( \textbf{w}_{lin} ) =\frac{1}{N}  (\epsilon^T (H-I)^T (H-I) \epsilon) = \frac{1}{N} \epsilon^T (I-H) \epsilon = \frac{1}{N} \epsilon^T \epsilon - \frac{1}{N} \epsilon^T H \epsilon


Here, I see that,

\mathbb{E}_D[\frac{1}{N} \epsilon^T \epsilon] = \frac {N \sigma^2}{N}

And, also, the sum formed by - \frac{1}{N} \epsilon^T H \epsilon, gives the following sum,

- \frac{1}{N} \epsilon^T H \epsilon = - \frac{1}{N} \{ \sum_{i=1}^{N} H_{ii} \epsilon_i^2 + \sum_{i,j \ \in \ \{1..N\} \ and \ i \neq j}^{} \ H_{ij} \ \epsilon_i \ \epsilon_j \}

I undestand that,

- \frac{1}{N} \mathbb{E}_D[\sum_{i=1}^{N} H_{ii} \epsilon_i^2] = - trace(H) \ \sigma^2 = - (d+1) \ \sigma^2


However, I don't understand why,

- \frac{1}{N} \mathbb{E}_D[\sum_{i,j \ \in \ \{1..N\} \ and \ i \neq j}^{} \ H_{ij} \ \epsilon_i \ \epsilon_j ] = 0 \ \ \ \ \ \ \ \ \ \ \ \ (eq \ 1)


(eq 1) should be equal to zero in order to satisfy the equation,



\mathbb{E}_D[E_{in}( \textbf{w}_{lin} )] = \sigma^2 (1 - \frac{d+1}{N})


***Can any one mind to explain me why (eq1) leads to a zero result ?***
Reply With Quote
  #3  
Old 05-30-2014, 05:49 AM
tomaci_necmi tomaci_necmi is offline
Junior Member
 
Join Date: May 2014
Posts: 3
Default Re: Exercise 3.4

Well all fits now, just my mind played a game to me.

off course \mathbb{E}[\epsilon_i] = 0
Reply With Quote
  #4  
Old 05-30-2014, 11:46 AM
yaser's Avatar
yaser yaser is offline
Caltech
 
Join Date: Aug 2009
Location: Pasadena, California, USA
Posts: 1,474
Default Re: Exercise 3.4

Thank you for the question and the answer.
__________________
Where everyone thinks alike, no one thinks very much
Reply With Quote
  #5  
Old 08-03-2015, 01:33 AM
yongxien yongxien is offline
Junior Member
 
Join Date: Jun 2015
Posts: 8
Default Re: Exercise 3.4

Why the last statement is 0? I don't quite understand. Does the mean being zero imply E(e_i) and E(e_j) = 0? I find it weird if that is the case. Because that will mean E(e_i) = 0 but E(e_i^2) = \sigma^2. I understand E(e_i^2) = \sigma^2 from statistics but not the first part.

If it is not the case, then what is the reason for the last statement to be 0?
Reply With Quote
  #6  
Old 08-03-2015, 03:22 PM
htlin's Avatar
htlin htlin is offline
NTU
 
Join Date: Aug 2009
Location: Taipei, Taiwan
Posts: 573
Default Re: Exercise 3.4

In the problem statement, I think "zero mean of the noise" is a given condition?
__________________
When one teaches, two learn.
Reply With Quote
  #7  
Old 10-07-2016, 07:13 PM
zhout2 zhout2 is offline
Junior Member
 
Join Date: Oct 2016
Posts: 2
Default Re: Exercise 3.4

As \frac{1}{N}E(\epsilon^T H \epsilon)=\sigma ^2 (d+1),
The answer is really not \sigma ^2 (1-\frac{d+1}{N}), is it?
Reply With Quote
  #8  
Old 10-10-2016, 02:53 PM
zhout2 zhout2 is offline
Junior Member
 
Join Date: Oct 2016
Posts: 2
Default Re: Exercise 3.4

Quote:
Originally Posted by zhout2 View Post
As \frac{1}{N}E(\epsilon^T H \epsilon)=\sigma ^2 (d+1),
The answer is really not \sigma ^2 (1-\frac{d+1}{N}), is it?
Never mind. It's just a typo in the original post. The answer is still correct.
Reply With Quote
  #9  
Old 10-13-2017, 09:50 AM
johnwang johnwang is offline
Junior Member
 
Join Date: Oct 2017
Posts: 2
Default Re: Exercise 3.4

I still don't understand why "eq1" leads to zero. I know that e_i and e_j are zero mean independent variables. However, H_ij is dependent on both e_i and e_j,, so I don't know how to prove that the sum of H_ij*e_i*e_j has an expected value of zero.

Quote:
Originally Posted by tomaci_necmi View Post
In my textbook, there is a statement mentioned on the topic of linear regression/machine learning, and a question, which is simply quoted as,

Consider a noisy target, y = (w^{*})^T \textbf{x} + \epsilon, for generating the data, where \epsilon is a noise term with zero mean and \sigma^2 variance, independently generated for every example (\textbf{x},y). The expected error of the best possible linear fit to this target is thus \sigma^2.

For the data D =  \{ (\textbf{x}_1,y_1), ..., (\textbf{x}_N,y_N)  \}, denote the noise in y_nas \epsilon_n, and let \mathbf{\epsilon}   = [\epsilon_1, \epsilon_2, ...\epsilon_N]^T; assume that X^TX is invertible. By following the steps below, ***show that the expected in-sample error of linear regression with respect to D is given by***,

\mathbb{E}_D[E_{in}( \textbf{w}_{lin} )] = \sigma^2 (1 - \frac{d+1}{N})


Below is my methodology,


Book says that,

In-sample error vector, \hat{\textbf{y}} - \textbf{y}, can be expressed as (H-I)\epsilon, which is simply, hat matrix, H= X(X^TX)^{-1}X^T, times, error vector, \epsilon.

So, I calculated in-sample error, E_{in}( \textbf{w}_{lin} ), as,

E_{in}( \textbf{w}_{lin} ) = \frac{1}{N}(\hat{\textbf{y}} - \textbf{y})^T (\hat{\textbf{y}} - \textbf{y}) =  \frac{1}{N}  (\epsilon^T (H-I)^T (H-I) \epsilon)

Since it is given by the book that,

(I-H)^K = (I-H), and also (I-H) is symetric, trace(H) = d+1

I got the following simplified expression,

E_{in}( \textbf{w}_{lin} ) =\frac{1}{N}  (\epsilon^T (H-I)^T (H-I) \epsilon) = \frac{1}{N} \epsilon^T (I-H) \epsilon = \frac{1}{N} \epsilon^T \epsilon - \frac{1}{N} \epsilon^T H \epsilon


Here, I see that,

\mathbb{E}_D[\frac{1}{N} \epsilon^T \epsilon] = \frac {N \sigma^2}{N}

And, also, the sum formed by - \frac{1}{N} \epsilon^T H \epsilon, gives the following sum,

- \frac{1}{N} \epsilon^T H \epsilon = - \frac{1}{N} \{ \sum_{i=1}^{N} H_{ii} \epsilon_i^2 + \sum_{i,j \ \in \ \{1..N\} \ and \ i \neq j}^{} \ H_{ij} \ \epsilon_i \ \epsilon_j \}

I undestand that,

- \frac{1}{N} \mathbb{E}_D[\sum_{i=1}^{N} H_{ii} \epsilon_i^2] = - trace(H) \ \sigma^2 = - (d+1) \ \sigma^2


However, I don't understand why,

- \frac{1}{N} \mathbb{E}_D[\sum_{i,j \ \in \ \{1..N\} \ and \ i \neq j}^{} \ H_{ij} \ \epsilon_i \ \epsilon_j ] = 0 \ \ \ \ \ \ \ \ \ \ \ \ (eq \ 1)


(eq 1) should be equal to zero in order to satisfy the equation,



\mathbb{E}_D[E_{in}( \textbf{w}_{lin} )] = \sigma^2 (1 - \frac{d+1}{N})


***Can any one mind to explain me why (eq1) leads to a zero result ?***
Reply With Quote
  #10  
Old 10-13-2017, 09:55 AM
johnwang johnwang is offline
Junior Member
 
Join Date: Oct 2017
Posts: 2
Default Re: Exercise 3.4

Is it because the noise is generated independently for each datapoint?
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 11:11 AM.


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