def _back_prop(self, x, y):
    nabla_b = [np.zeros(bias.shape) for bias in self.biases]
    nabla_w = [np.zeros(weight.shape) for weight in self.weights]
    error = ((self._activations[(- 1)] - y) * sigmoid_prime(self._zs[(- 1)]))
    nabla_b[(- 1)] = error
    nabla_w[(- 1)] = error.dot(self._activations[(- 2)].transpose())
    for l in range((self.num_layers - 2), 0, (- 1)):
        error = np.multiply(self.weights[(l + 1)].transpose().dot(error), sigmoid_prime(self._zs[l]))
        nabla_b[l] = error
        nabla_w[l] = error.dot(self._activations[(l - 1)].transpose())
    return (nabla_b, nabla_w)
def _back_prop(self, x, y):
    nabla_b = [np.zeros(bias.shape) for bias in self.biases]
    nabla_w = [np.zeros(weight.shape) for weight in self.weights]
    error = ((self._activations[(- 1)] - y) * sigmoid_prime(self._zs[(- 1)]))
    nabla_b[(- 1)] = error
    nabla_w[(- 1)] = error.dot(self._activations[(- 2)].transpose())
    for l in range((self.num_layers - 2), 0, (- 1)):
        error = np.multiply(self.weights[(l + 1)].transpose().dot(error), sigmoid_prime(self._zs[l]))
        nabla_b[l] = error
        nabla_w[l] = error.dot(self._activations[(l - 1)].transpose())
    return (nabla_b, nabla_w)