Cost function
-
Squared error function:
J(a, b) = (sum of (h(xi) - yi)^2)/2m
whereh(x) = ax^2 + b
-
It is probably the most common used for linear regression problems because it seems to work the best in most cases.
-
We would like to find
a
andb
soJ(a, b)
is minimal. -
If we assume b=0 then we are looking at
min(J(a, 0))
which is a 2D function -
In the general case though
min(J(a, b))
is a 3D function for which we need to find the minimum -
Contour plots (contour figures)