def SGD_final_layer(self, training_data, epochs, mini_batch_size, eta, lmbda):
 encoded_training_data = [(self.feedforward(x, start=0, end=(self.num_layers - 2)), y) for (x, y) in training_data]
 net = Network(self.sizes[(-2):])
 net.biases[0] = self.biases[(-1)]
 net.weights[0] = self.weights[(-1)]
 net.SGD(encoded_training_data, epochs, mini_batch_size, eta, lmbda)
 self.biases[(-1)] = net.biases[0]
 self.weights[(-1)] = net.weights[0]

def SGD_final_layer ( self , training_data , epochs , mini_batch_size , eta , lmbda ) : encoded_training_data = [ ( self . feedforward ( x , start = 0 , end = ( self . num_layers - 2 ) ) , y ) for ( x , y ) in training_data ] net = Network ( self . sizes [ ( - 2 ) : ] ) net . biases [ 0 ] = self . biases [ ( - 1 ) ] net . weights [ 0 ] = self . weights [ ( - 1 ) ] net . SGD ( encoded_training_data , epochs , mini_batch_size , eta , lmbda ) self . biases [ ( - 1 ) ] = net . biases [ 0 ] self . weights [ ( - 1 ) ] = net . weights [ 0 ]
run sgd on the final layer of the network self .