Created
October 9, 2018 02:24
-
-
Save srikarplus/ff6e64f35ce3444712b37c008f3b8349 to your computer and use it in GitHub Desktop.
neural network prediction
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
def predict(theta1, theta2, X, y): | |
m = len(y) | |
ones = np.ones((m,1)) | |
a1 = np.hstack((ones, X)) | |
a2 = sigmoid(a1 @ theta1.T) | |
a2 = np.hstack((ones, a2)) | |
h = sigmoid(a2 @ theta2.T) | |
return np.argmax(h, axis = 1) + 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment