+def train(images, labels, eta, batch_size=100):
+ '''Do backpropagation for smaller batches
+
+ This greatly speeds up the learning process, at the expense of finding a more erratic path to the local minimum.
+ '''
+ num_images = images.shape[1]
+ offset = 0
+ while offset < num_images:
+ images_batch = images[:, offset:offset + batch_size]
+ labels_batch = labels[offset:offset + batch_size]
+ backpropagate(images_batch, labels_batch, eta)
+ offset += batch_size
+
+