Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Check Results
- # Call the Feedforward Function to get h
- h <- feedforward(X,Theta1,Theta2)
- dim(h)
- #Recode the labels as vectors containing only values 0 or 1
- #For example, if x(i) is an image of the digit 5,
- #then the corresponding y(i) (that you should use with the cost function)
- #should be a 10-dimensional vector with y5 = 1, and the other elements equal to 0.
- y_matrix <- matrix(0, nrow = length(y), ncol = 10)
- dim(y_matrix)
- for (i in 1:m){
- ans <- y[i]
- y_matrix[i,ans] <- 1
- }
- # Check the Dimension of y
- m = length(y)
- # Compute cost
- J=ComputeFFCost(h,y_matrix,m)
- J
Add Comment
Please, Sign In to add comment