predict.m 746 B

123456789101112131415161718192021222324252627
  1. function p = predict(theta, X)
  2. %PREDICT Predict whether the label is 0 or 1 using learned logistic
  3. %regression parameters theta
  4. % p = PREDICT(theta, X) computes the predictions for X using a
  5. % threshold at 0.5 (i.e., if sigmoid(theta'*x) >= 0.5, predict 1)
  6. m = size(X, 1); % Number of training examples
  7. % You need to return the following variables correctly
  8. p = round(hypothesis(theta, X));
  9. % ====================== YOUR CODE HERE ======================
  10. % Instructions: Complete the following code to make predictions using
  11. % your learned logistic regression parameters.
  12. % You should set p to a vector of 0's and 1's
  13. %
  14. % =========================================================================
  15. end