Unsupervised Deep Learning in Python: Master Data Science and Machine Learning with Modern Neural Networks written in Python and Theano (Machine Learning in Python) by LazyProgrammer

Unsupervised Deep Learning in Python: Master Data Science and Machine Learning with Modern Neural Networks written in Python and Theano (Machine Learning in Python) by LazyProgrammer

Author:LazyProgrammer
Language: eng
Format: epub
Published: 2016-06-29T22:00:00+00:00


X_in = T.matrix('X_%s' % self.id)

X_hat = self.forward_output(X_in)

# attach it to the object so it can be used later

# must be sigmoidal because the output is also a sigmoid

H = T.nnet.sigmoid(X_in.dot(self.W) + self.bh)

self.hidden_op = theano.function(

inputs=[X_in],

outputs=H,

)

# cost = ((X_in - X_hat) * (X_in - X_hat)).sum() / N

cost = -(X_in * T.log(X_hat) + (1 - X_in) * T.log(1 - X_hat)).sum() / N

cost_op = theano.function(

inputs=[X_in],

outputs=cost,

)

updates = [

(p, p + mu*dp - learning_rate*T.grad(cost, p)) for p, dp in zip(self.params, self.dparams)

] + [

(dp, mu*dp - learning_rate*T.grad(cost, p)) for p, dp in zip(self.params, self.dparams)

]

train_op = theano.function(

inputs=[X_in],

updates=updates,

)



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.