You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function J = costFunctionJ(X, Y, Theta)% X is desgin matrix contanining all of the traning data% Y is the real pricem = size (X, 1); % how many rows does X have, m means the size of traning setPredictions = X*Theta; % here you will get a m x 1 matrix, actually this is a vector, whose length is the same as Y's, so it's ok to use Predictions substract YsqrErrors = (Predictions-Y).^2;J = 1/(2*m)*sum(sqrErrors);