Mean Squared Error Cost Function (MSE) Mean Squared Error (MSE) is the Cost Function used in Linear Regression. As the name says, we calculate the Average of the Squared Error between our prediction y^ / f (x) and the original target y. w,b Equation 1 J (w, b) = 2m m ∑ (f w,b (x (i) ) − y (i) ) 2 i=1 : the MSE cost function for the parameters w, b. Note that the cost function is for the whole dataset used. As we use summation over the entire data from i = 1 to m. J (w, b) : the average (mean) of the the squared error. (we use 2 for neater results, as it will get cancelled in the derivation process in the gradient descent process). 1 2m ∑ f w,b (x m i=1 (i) (. . . ) ) − y 2 (i) : the error for a single training set.