Cost Function
Last updated
Was this helpful?
Last updated
Was this helpful?
We can measure the accuracy of our hypothesis function by using a cost function. This takes an average (actually a fancier version of an average) of all the results of the hypothesis with inputs from x's compared to the actual output y's.
If m is the number of training examples, the cost function for Linear Regression in One Variable is given by:
Lower values indicate more accuracy.
This function is otherwise called the "Squared error function", or Mean squared error.
We can plot it on a graph taking and on the x and z axis respectively, and J on the y axis: