Skip to content

Commit 306b12f

Browse files
committed
move regularization norm out of loop
1 parent ea229ac commit 306b12f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

network2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def total_cost(self, data, lmbda, convert=False):
312312
a = self.feedforward(x)
313313
if convert: y = vectorized_result(y)
314314
cost += self.cost.fn(a, y)/len(data)
315-
cost += 0.5*(lmbda/len(data))*sum(np.linalg.norm(w)**2 for w in self.weights) # '**' - to the power of.
315+
cost += 0.5*(lmbda/len(data))*sum(np.linalg.norm(w)**2 for w in self.weights) # '**' - to the power of.
316316
return cost
317317

318318
def save(self, filename):

0 commit comments

Comments
 (0)