reset password
Author Message
msargent
Posts: 519
Posted 08:34 Feb 10, 2015 |

These are taken from the Coursera logistic regression assignment. You don't have to implement the sigmoid function separately as below, but if you want to this is how to do it. Formulae for the cost and gradient functions are below as well. 

Also, the h(x) you put into your cost function should just be 1/(1+e to the -theta transpose x). It shouldn't predict 1 or 0 (you'll end up trying to take the log of 0). When you implement a prediction function to test accuracy, then you can convert to 0 or 1.

Last edited by msargent at 08:43 Feb 10, 2015.