Least Square
Linear Least Squares
prediction=y(x,w)=w0+w1x1+⋯+wdxd=w0+Σj=1dwjxj
E(w)=21Σn=1N(xn⊺w−tn)2=21(Xw−t)⊺(Xw−t)
E is the loss function.
Solve minwE(w)
W∗=(X⊺X)−1X⊺t
where
- W∗ is the optimal weights
- X is the design matrix (data) (one input vector per row)
- t is the vector of target values
Polynomial Curve Fitting
y(x,w)=w0+w1x+w2x2+⋯+wMxM=Σj=0Mwjxj
Polynomial function is a nonlinear function of x, but it's a linear function of the coefficients w, thus it's still a linear model.
E(w)=21Σi=1N(y(xn,w)−tn)2