view predict.m @ 1:8b902ada47e9

Complete part 1
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sat, 29 Oct 2011 21:03:10 -0500
parents 5664e0047b3e
children a4c4da8f4ac0
line wrap: on
line source

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)

  p = sigmoid (X*theta) >= 0.5;

end