LFD Book Forum Normal equation in linear regression
 User Name Remember Me? Password
 FAQ Calendar Mark Forums Read

 Thread Tools Display Modes
#1
07-25-2012, 02:59 PM
 lorddoskias Junior Member Join Date: Jul 2012 Posts: 9
Normal equation in linear regression

From coursera's ML course I've known that the normal equation is calculated as follows:

pinv((X'*X))*X'*Y; (octave code) but apparently this is equivalent to just pinv(X)*Y;

Can anyone explain why this is the case?
#2
07-25-2012, 03:12 PM
 yaser Caltech Join Date: Aug 2009 Location: Pasadena, California, USA Posts: 1,477
Re: Normal equation in linear regression

Quote:
 Originally Posted by lorddoskias pinv((X'*X))*X'*Y; (octave code) but apparently this is equivalent to just pinv(X)*Y; Can anyone explain why this is the case?
pinv is already the pseudo inverse function. When applied to an invertible matrix (in this case X'*X), it returns the regular inverse.
__________________
Where everyone thinks alike, no one thinks very much
#3
09-19-2012, 12:06 AM
 Daniel Junior Member Join Date: Jun 2012 Posts: 4
Re: Normal equation in linear regression

Dr. Ng derived the Normal Equation in class, see Lecture 4-6 and he also cautioned about the case where X'*X is non-invertible which meant that there were redundant features (linearly dependent) or too many features (m <= n).

Daniel
#4
09-20-2012, 04:24 AM
 magdon RPI Join Date: Aug 2009 Location: Troy, NY, USA. Posts: 595
Re: Normal equation in linear regression

Just a small correction on notation. The normal equations for linear regression are

The solution to the normal equations (for ) is given by the formula that you mention, and indeed the two solutions are equivalent. A proof of this fact is using the singular value decomposition:

and

where and . So,

Quote:
 Originally Posted by lorddoskias From coursera's ML course I've known that the normal equation is calculated as follows: pinv((X'*X))*X'*Y; (octave code) but apparently this is equivalent to just pinv(X)*Y; Can anyone explain why this is the case?
__________________
Have faith in probability
#5
09-25-2012, 01:25 AM
 broken857 Junior Member Join Date: Sep 2012 Posts: 1
Re: Normal equation in linear regression

Thanks you all for useful input. We have some reading to do... :-)
__________________
williamjhone

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home General     General Discussion of Machine Learning     Free Additional Material         Dynamic e-Chapters         Dynamic e-Appendices Course Discussions     Online LFD course         General comments on the course         Homework 1         Homework 2         Homework 3         Homework 4         Homework 5         Homework 6         Homework 7         Homework 8         The Final         Create New Homework Problems Book Feedback - Learning From Data     General comments on the book     Chapter 1 - The Learning Problem     Chapter 2 - Training versus Testing     Chapter 3 - The Linear Model     Chapter 4 - Overfitting     Chapter 5 - Three Learning Principles     e-Chapter 6 - Similarity Based Methods     e-Chapter 7 - Neural Networks     e-Chapter 8 - Support Vector Machines     e-Chapter 9 - Learning Aides     Appendix and Notation     e-Appendices

All times are GMT -7. The time now is 02:00 PM.

 Contact Us - LFD Book - Top