Closed flipdazed closed 7 years ago
updates are held outside the NN class
gparams = [T.grad(cost, param) for param in classifier.params]
updates = [
(param, param - learning_rate * gparam)
for param, gparam in zip(classifier.params, gparams)
]
can return from the training function as gradients and multiply by learning_rate
train_model = theano.function(
inputs=[index],
outputs=[cost] + gparams,
updates=updates,
givens={
x: train_set_x[index * batch_size: (index + 1) * batch_size],
y: train_set_y[index * batch_size: (index + 1) * batch_size]
}
)
Big issue with multiple outputs in theano.function
http://stackoverflow.com/q/40272716/4013571
In essence, a workaround is needed such that .get_value
is not assigned before the training process.
Aim As with the histogram of parameter values in #6 except this time with the update values