Skip to content

Instantly share code, notes, and snippets.

@TylerL-uxai
Created October 12, 2015 16:37
Show Gist options
  • Save TylerL-uxai/946319a7fd3bf34a8d0a to your computer and use it in GitHub Desktop.
Save TylerL-uxai/946319a7fd3bf34a8d0a to your computer and use it in GitHub Desktop.
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
% 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
%
% added by Tyler (student)
% if it's greater than .5 , p = 1, otherwise p = 0
% =========================================================================
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment