Created
November 1, 2011 03:22
-
-
Save dmichael/1329789 to your computer and use it in GitHub Desktop.
Sigmoid function
This file contains hidden or 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
| function g = sigmoid(z) | |
| % Compute the sigmoid of z. | |
| % z can be a matrix, vector or scalar. | |
| g = 1.0 ./ (1.0 + exp(-z)); | |
| % 1./ (1 + e.^-z); <-- this is equivalent | |
| end | |
| hypothesis = sigmoid(X*theta); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment