Guest User

Untitled

a guest
Jul 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. ######
  2. #It uses the cross entropy error function:
  3. f = -(1/batchSize)*sum(data*log(recon) + (1-data)*log(1-recon))
  4.  
  5. #compute derivatives for the last layer
  6. Ix_n2 = (1/float(batchSize))*(recon-data)
  7. # outer product
  8. # w_n2_probs the outputs at the layer before the last
  9.  
  10. dwLast = dot(w_n2_probs.t, Ix_n2)
  11.  
  12.  
  13. # compute derivatives for the first layer
  14. # w1probs are the outputs at the first layer
  15. # w1 the weights of the first layer
  16. #
  17.  
  18. Ix1 = dot(w1, Ix2.t).t
  19. Ix1 = Ix1*w1probs*(1-w1probs)
  20. Ix1 = Ix1[:,0:-1]
  21.  
  22. data = c_[data, ones(batchSize)]
  23. # outer product
  24. w1 = dot(data.t, Ix1)
  25. #
Add Comment
Please, Sign In to add comment