by latenightcoding · 9y ago · 0 comments
used to find the line of best fit.
The first time I saw it I was in high school and I was watching Andrew Ng's machine learning class for the first time. My Math background was not the best and I didn't fully understand it until a couple of years later when I took MIT's free online course on linear algebra (OCW 18.06)
Proof: Since `B` is a minimum, the derivative of the expression minimized wrt `B` must be zero (the "derivative" is taken in the matrix sense here).
0 = d/dB [ (Y - XB)'(Y - XB) ]
= d/dB [ Y′Y − Y′XB − B′X′Y + B′X′XB ]
= d/dB [ Y′Y − 2Y′XB + B′X′XB ] Y′XB and B′X′Y are just scalars :)
= − 2Y′X + 2′X′XB
Solving for `B` you get the result.[1] https://isites.harvard.edu/fs/docs/icb.topic515975.files/OLS...
One of my favourite math lectures.