1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

29 lines
757 B
Matlab

function p = predict(theta, X)
10 years ago
%PREDICT Predict whether the label is 0 or 1 using learned logistic
%regression parameters theta
10 years ago
% p = PREDICT(theta, X) computes the predictions for X using a
% threshold at 0.5 (i.e., if sigmoid(theta'*x) >= 0.5, predict 1)
m = size(X, 1); % Number of training examples
% You need to return the following variables correctly
p = zeros(m, 1);
% ====================== YOUR CODE HERE ======================
% Instructions: Complete the following code to make predictions using
10 years ago
% your learned logistic regression parameters.
% You should set p to a vector of 0's and 1's
%
10 years ago
p = sigmoid(X * theta) > 0.5;
% =========================================================================
end