Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cost function

  • Squared error function: J(a, b) = (sum of (h(xi) - yi)^2)/2m where h(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 and b so J(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)