Skip to content

use the vectorization to accelerate the calculation#1

Open
comeonsunny wants to merge 1 commit intoY1ran:masterfrom
comeonsunny:patch-1
Open

use the vectorization to accelerate the calculation#1
comeonsunny wants to merge 1 commit intoY1ran:masterfrom
comeonsunny:patch-1

Conversation

@comeonsunny
Copy link

% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta
% You should set J to the cost.
sum = 0;
temp_cost = X * theta - y;
for i = 1:m
sum = sum + temp_cost(i)^2;
end

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

% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta
%               You should set J to the cost.
sum = 0;
temp_cost = X * theta - y;
for i = 1:m
    sum = sum + temp_cost(i)^2;
end

J = (1/(2*m))*sum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant