In cases where the data cannot be fit using a linear decision boundary, we may want to use polynomial regression.
Say we want to use a degree 2 polynomial. The equation can be given by:
g(x∣w2,w1,w0)=w2x2+w1x+w0
Our aim is to find values for w0,w1,w2 that minimize the squared error ∑t(rt−g(xt))2
Note: Given a dataset {xt,rt}t=1N where xt∈R i.e. where xt=[x1t] (1 dimension), to find the polynomial of degree 2
g(x∣w2,w1,w0)=w2x2+w1x+w0 that minimizes the squared error, we can construct a related dataset with inputs in R2 (2 dimensions) with the second dimension x2t=(x1t)2, and then use simple linear regression on this new dataset to obtain w2,w1,w0 that minimize the squared error, and finally output g(x∣w2,w1,w0)=w2x2+w1x+w0 with these w2,w1,w0 values as the best 2 degree polynomial that fits the original dataset.
This can be extended to higher degree polynomials as well.