w22116972
7/23/2015 - 1:13 PM

cost function of linear regression

cost function of linear regression

function J = computeCost(X, y, theta)
m = length(y);
J = 0;

H = (theta'*X')';
S = sum((H - y) .^ 2);
J = S / (2*m);
end