function J = costFunctionJ(X, y,theta)

% X is the 'design matrix' containing our tarring examples. 
% y is the class labels

m = size(X,1);             % the number of trains examples
Predictions = X * theta;   % the prediction of hypothesis on all m examples 
sqrErrors = (Predictions - y) .^2;  % squared errors

J = 1/(2*m) * sum(sqrErrors);