Update 7_2_Backpropagation.ipynb

This commit is contained in:
Pietro Monticone
2023-10-30 17:57:39 +01:00
parent 21fe352e75
commit f57925947d

View File

@@ -143,7 +143,7 @@
" # Run through the layers, calculating all_f[0...K-1] and all_h[1...K]\n", " # Run through the layers, calculating all_f[0...K-1] and all_h[1...K]\n",
" for layer in range(K):\n", " for layer in range(K):\n",
" # Update preactivations and activations at this layer according to eqn 7.16\n", " # Update preactivations and activations at this layer according to eqn 7.16\n",
" # Remmember to use np.matmul for matrrix multiplications\n", " # Remember to use np.matmul for matrix multiplications\n",
" # TODO -- Replace the lines below\n", " # TODO -- Replace the lines below\n",
" all_f[layer] = all_h[layer]\n", " all_f[layer] = all_h[layer]\n",
" all_h[layer+1] = all_f[layer]\n", " all_h[layer+1] = all_f[layer]\n",
@@ -299,7 +299,7 @@
"# Let's test if we have the derivatives right using finite differences\n", "# Let's test if we have the derivatives right using finite differences\n",
"delta_fd = 0.000001\n", "delta_fd = 0.000001\n",
"\n", "\n",
"# Test the dervatives of the bias vectors\n", "# Test the derivatives of the bias vectors\n",
"for layer in range(K):\n", "for layer in range(K):\n",
" dl_dbias = np.zeros_like(all_dl_dbiases[layer])\n", " dl_dbias = np.zeros_like(all_dl_dbiases[layer])\n",
" # For every element in the bias\n", " # For every element in the bias\n",