选择 a,b :min F(a,b),F(a,b)=sum (yi - a - bxi)^2 ,where yi,xi are samples (yi = y1,y2...yn)
To do that:F(a,b)对a,b导数均=0
F(a,b)对b导数=0 =>
sum 2(Yi - a - bxi) (-1) =0 =>
sum (Yi - a - bxi) =0 =>
sum(Yi) - na - b sum(xi) = 0 =>
sum(Yi)/n -a - bsum(xi)/n = 0 =>
Y的平均值 - a - b X的平均值 =0 =>
Y的平均值 = a + b X的平均值 => 线性回归方程 ^Y=bx+a 必过 (X的平均值,Y的平均值)