Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # create FeefForward Neural Network
- feedforward <- function(X, Theta1,Theta2) {
- #Add a column of 1s to X (the first column), and it becomes 'a1'.
- a1 <- cbind(1, X)
- #Multiply by Theta1 and we have 'z2'.
- z2 <- a1 %*% t(Theta1)
- #Compute the sigmoid() of 'z2', then add a column of 1's, and it becomes 'a2'
- a2 <- sigmoid(z2)
- a2 <- cbind(1, a2)
- #Multiply by Theta2 and you have 'z3'.
- z3 = a2 %*% t(Theta2)
- #Compute the sigmoid() of z3, then add a column of 1's, and it becomes 'a3'
- a3 = sigmoid(z3);
- h=a3
- }
Add Comment
Please, Sign In to add comment