[0e6e15]: / predict.m

Download this file

12 lines (8 with data), 347 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
function p = predict(theta, X)
%PREDICT Predict whether the label is 0 or 1 using learned logistic
%regression parameters theta
% 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
p = round(sigmoid(X * theta));
end