-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74a99b5
commit aeba21d
Showing
1 changed file
with
1 addition
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,13 @@ | ||
function p = predict(theta, X) | ||
%PREDICT Predict whether the label is 0 or 1 using learned logistic | ||
%PREDICT Predicts 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 | ||
|
||
% You need to return the following variables correctly | ||
p = zeros(m, 1); | ||
|
||
% ====================== YOUR CODE HERE ====================== | ||
% Instructions: Complete the following code to make predictions using | ||
% your learned logistic regression parameters. | ||
% You should set p to a vector of 0's and 1's | ||
% | ||
|
||
|
||
h = sigmoid(X*theta); | ||
p = h>=0.5; | ||
|
||
|
||
|
||
|
||
% ========================================================================= | ||
|
||
|
||
end |