(theta_value)
| 238 | |
| 239 | # creates a function that computes the average cost on the training set |
| 240 | def train_fn(theta_value): |
| 241 | classifier.theta.set_value(theta_value, borrow=True) |
| 242 | train_losses = [batch_cost(i * batch_size) |
| 243 | for i in range(n_train_batches)] |
| 244 | return numpy.mean(train_losses) |
| 245 | |
| 246 | # creates a function that computes the average gradient of cost with |
| 247 | # respect to theta |