Skip to content

Commit a5918b9

Browse files
author
Merouane Atig
committed
Add regularization to backpropagation
1 parent 8c86d19 commit a5918b9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mlclass-ex4/nnCostFunction.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
Theta2_grad = Theta2_grad / m;
9898

9999

100+
Theta1_grad(:, 2:end) = Theta1_grad(:, 2:end) + lambda / m * Theta1(:, 2:end);
101+
Theta2_grad(:, 2:end) = Theta2_grad(:, 2:end) + lambda / m * Theta2(:, 2:end);
100102

101103

102104

0 commit comments

Comments
 (0)