neural networks and deep learning num_iter is the number of iterations over the batches overrides epochs if provided (allows for fractions of epochsreport_each means give the errors after each multiple of that iterations ""self batch_size min(batch_sizelen(self training_set)don' have batches bigger than training size if num_iter is nonenum_iter (epochs len(self training_set)/self batch_size #self display( ,"batch\ ","\tjoin(criterion __doc__ for criterion in evaluate all_criteria)for in range(num_iter)batch random sample(self training_setself batch_sizefor in batchcompute all outputs values [ (efor in self input_featuresfor layer in self layersvalues layer output_values(valuestraining=truebackpropagate predicted [sigmoid(vfor in valuesif self output_type ="boolean"else softmax(valuesif self output_type ="categorical"else values actuals indicator(self dataset target( )self dataset target frangeif self output_type ="categorical"else [self dataset target( )errors [pred-obsd for (obsd,predin zip(actuals,predicted)for layer in reversed(self layers)errors layer backprop(errorsupdate all parameters in batch for layer in self layerslayer update(self bn+= if ( + )%report_each== self display( ,self bn,"\ ""\ \tjoin("{ }formatself dataset evaluate_dataset(self validation_setself predictorcriterion)for criterion in evaluate all_criteria)sep="" improved optimization momentum learnnn py -(continued class linear_complete_layer_momentum(linear_complete_layer)version june