Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######
- #It uses the cross entropy error function:
- f = -(1/batchSize)*sum(data*log(recon) + (1-data)*log(1-recon))
- #compute derivatives for the last layer
- Ix_n2 = (1/float(batchSize))*(recon-data)
- # outer product
- # w_n2_probs the outputs at the layer before the last
- dwLast = dot(w_n2_probs.t, Ix_n2)
- # compute derivatives for the first layer
- # w1probs are the outputs at the first layer
- # w1 the weights of the first layer
- #
- Ix1 = dot(w1, Ix2.t).t
- Ix1 = Ix1*w1probs*(1-w1probs)
- Ix1 = Ix1[:,0:-1]
- data = c_[data, ones(batchSize)]
- # outer product
- w1 = dot(data.t, Ix1)
- #
Add Comment
Please, Sign In to add comment