Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: chapter8 batch processing #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: chapter8 batch processing
  • Loading branch information
andreinechaev committed Nov 20, 2020
commit a63f80d56632d0984698fda9e13a0267776e0e87
Original file line number Diff line number Diff line change
Expand Up @@ -426,12 +426,12 @@
" for k in range(batch_size):\n",
" correct_cnt += int(np.argmax(layer_2[k:k+1]) == np.argmax(labels[batch_start+k:batch_start+k+1]))\n",
"\n",
" layer_2_delta = (labels[batch_start:batch_end]-layer_2)/batch_size\n",
" layer_1_delta = layer_2_delta.dot(weights_1_2.T)* relu2deriv(layer_1)\n",
" layer_1_delta *= dropout_mask\n",
" layer_2_delta = (labels[batch_start:batch_end]-layer_2)\n",
" layer_1_delta = layer_2_delta.dot(weights_1_2.T)* relu2deriv(layer_1)\n",
" layer_1_delta *= dropout_mask\n",
"\n",
" weights_1_2 += alpha * layer_1.T.dot(layer_2_delta)\n",
" weights_0_1 += alpha * layer_0.T.dot(layer_1_delta)\n",
" weights_1_2 += alpha * layer_1.T.dot(layer_2_delta)\n",
" weights_0_1 += alpha * layer_0.T.dot(layer_1_delta)\n",
" \n",
" if(j%10 == 0):\n",
" test_error = 0.0\n",
Expand Down Expand Up @@ -482,4 +482,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}