Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision |
courses:cs211:winter2012:journals:jeanpaul:chaptersixsectioniii [2012/03/28 01:50] – [The Problem] mugabej | courses:cs211:winter2012:journals:jeanpaul:chaptersixsectioniii [2012/03/28 02:00] – [The Problem] mugabej |
---|
>>>>>>>>>>>>>>>>>> (x<sub>1</sub>y<sub>1</sub>),(x<sub>2</sub>y<sub>2</sub>),...,(x<sub>n</sub>y<sub>n</sub>), where x<sub>1</sub> < x<sub>2</sub>,...,< x<sub>n</sub>\\ | >>>>>>>>>>>>>>>>>> (x<sub>1</sub>y<sub>1</sub>),(x<sub>2</sub>y<sub>2</sub>),...,(x<sub>n</sub>y<sub>n</sub>), where x<sub>1</sub> < x<sub>2</sub>,...,< x<sub>n</sub>\\ |
>>>>>>>>>>>>>>>>>> Given a line L with equation y = ax + b, we say that an "error" of L with respect to P is the sum of all of its squared distances to the points in P:\\ | >>>>>>>>>>>>>>>>>> Given a line L with equation y = ax + b, we say that an "error" of L with respect to P is the sum of all of its squared distances to the points in P:\\ |
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Error(L,P) = ∑<sub>i =1</sub><sup>n</sup> (y<sub>i</sub> - ax<sub>i</sub>- b) <sup>2</sup>\\ | >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Error(L,P) = ∑<sub> from i =1 to n</sub> (y<sub>i</sub> - ax<sub>i</sub>- b) <sup>2</sup>\\ |
>>>>>>>>>>>>>>>>>> Thus naturally, we are bound to finding the line with minimum error.\\ | >>>>>>>>>>>>>>>>>> Thus naturally, we are bound to finding the line with minimum error.\\ |
| >>>>>>>>>>>>>>>>>> The solution turns out to be a line y = ax + b, where:\\ |
| >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> a = [(n∑<sub>i</sub> x<sub>i</sub>y<sub>i</sub>) - (∑<sub>i</sub>x<sub>i</sub>)(∑<sub>i</sub> y<sub>i</sub>)]/[(n∑<sub>i</sub> x<sub>i</sub><sup>2</sup>) - (∑<sub>i</sub> x<sub>i</sub>)<sup>2</sup>]\\ |
| >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> And b = (∑<sub>i</sub> y<sub>i</sub>- a∑<sub>i</sub> x<sub>i</sub>)/n\\ |