Skip to content

Commit d36cb2a

Browse files
committed
Bugfixing in deep_learning
1 parent ca9da53 commit d36cb2a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

code/deep_learning.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ def SGD_final_layer(
3535
"""
3636
Run SGD on the final layer of the Network ``self``. Note that
3737
``training_data`` is the input to the whole Network, not the
38-
encoded training data input to the final layer.
38+
encoded training data input to the final layer.
3939
"""
4040
net = Network([self.sizes[-2], self.sizes[-1]])
41-
encoded_training_data = self.feedforward(training_data, start=0, end=-1)
41+
encoded_training_data = [
42+
(self.feedforward(x, start=0, end=-1), y) for x, y in training_data]
4243
net.SGD(encoded_training_data, epochs, mini_batch_size, eta,
4344
lmbda, test, test_inputs, actual_test_results)
45+
self.biases[-1] = self.biases[-1]
46+
self.weights[-1] = net.weights[-1]
47+
4448

4549
# Add the SGD_final_layer method to the Network class
4650
Network.SGD_final_layer = SGD_final_layer

0 commit comments

Comments
 (0)