Skip to content

Commit

Permalink
Renaming of the book
Browse files Browse the repository at this point in the history
  • Loading branch information
mnielsen committed Jul 19, 2013
1 parent 0edd84e commit dfc5e27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Code samples for "Neural Networks for the Determined"
# Code samples for "Neural Networks and Deep Learning"

This repository contains code samples for my (forthcoming) book on
"Neural Networks for the Determined".
"Neural Networks and Deep Learning".

As the code is written to accompany the book, I don't intend to add
new features. However, bug reports are welcome, and you should of
Expand Down
10 changes: 5 additions & 5 deletions code/network_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ def SGD(self, training_data, epochs, mini_batch_size, eta,
but slows things down substantially. If ``test`` is set, then
appropriate ``test_data`` must be supplied.
"""
if test: n_test = len(test_inputs)
if test: n_test = len(test_data)
n = len(training_data)
for j in xrange(epochs):
random.shuffle(training_data)
mini_batches = [
training_data[k:k+mini_batch_size]
for k in xrange(0, len(training_data), mini_batch_size)]
for k in xrange(0, n, mini_batch_size)]
for mini_batch in mini_batches:
self.backprop(mini_batch, n, eta, lmbda)
if test:
Expand Down Expand Up @@ -117,9 +117,9 @@ def evaluate(self, test_data):
network outputs the correct result. Note that the neural
network's output is assumed to be the index of whichever
neuron in the final layer has the highest activation."""
test_results = [np.argmax(self.feedforward(x)) for x in test_data[0]]
return sum(int(x == y)
for x, y in zip(test_results, test_data[1]))
test_results = [(np.argmax(self.feedforward(x)), y)
for (x, y) in test_data]
return sum(int(x == y) for (x, y) in test_results)

def cost(self, x, y):
"""Return the quadratic cost associated to the network, with
Expand Down

0 comments on commit dfc5e27

Please sign in to comment.