Guest User

Untitled

a guest
Jul 11th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. # create FeefForward Neural Network
  2. feedforward <- function(X, Theta1,Theta2) {
  3. #Add a column of 1s to X (the first column), and it becomes 'a1'.
  4. a1 <- cbind(1, X)
  5. #Multiply by Theta1 and we have 'z2'.
  6. z2 <- a1 %*% t(Theta1)
  7. #Compute the sigmoid() of 'z2', then add a column of 1's, and it becomes 'a2'
  8. a2 <- sigmoid(z2)
  9. a2 <- cbind(1, a2)
  10. #Multiply by Theta2 and you have 'z3'.
  11. z3 = a2 %*% t(Theta2)
  12. #Compute the sigmoid() of z3, then add a column of 1's, and it becomes 'a3'
  13. a3 = sigmoid(z3);
  14. h=a3
  15. }
Add Comment
Please, Sign In to add comment