Skip to content

Commit

Permalink
remove answer
Browse files Browse the repository at this point in the history
  • Loading branch information
wassname committed Oct 13, 2020
1 parent e114b53 commit 894a1cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 44 deletions.
45 changes: 6 additions & 39 deletions notebooks/c02_Intro_to_NN_Part_2/Intro_to_NN_Part_2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1824,45 +1824,12 @@
"execution_count": null,
"metadata": {
"ExecuteTime": {
"start_time": "2020-10-13T05:58:42.602Z"
"end_time": "2020-10-13T06:00:52.239227Z",
"start_time": "2020-10-13T05:59:23.760111Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "90b0f467dd314fb4830cf6a3e19bf5a0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"HBox(children=(FloatProgress(value=0.0, max=10.0), HTML(value='')))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1, 10] loss: 0.0537\n",
"[1, 20] loss: 0.00856\n",
"[1, 30] loss: 0.0023\n",
"[1, 40] loss: 0.000716\n",
"[1, 50] loss: 0.00039\n",
"[1, 60] loss: 0.000216\n",
"[1, 70] loss: 0.000143\n"
]
}
],
"source": [
"learning_rate = 1e-3\n",
"convnet2 = BetterCNN().to(device)\n",
"optimizer = torch.optim.Adam(convnet2.parameters(), lr=learning_rate)\n",
"model = train(convnet2, x_train, y_train, criterion, optimizer, n_epochs=10)\n",
"test(model, x_test, y_test)"
]
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
Expand All @@ -1876,8 +1843,8 @@
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2020-10-13T05:57:46.993651Z",
"start_time": "2020-10-13T05:57:00.198Z"
"end_time": "2020-10-13T06:00:52.240942Z",
"start_time": "2020-10-13T05:59:24.354Z"
}
},
"outputs": [],
Expand Down
6 changes: 1 addition & 5 deletions notebooks/c02_Intro_to_NN_Part_2/Intro_to_NN_Part_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,7 @@ def forward(self, x):
#
# </details>

learning_rate = 1e-3
convnet2 = BetterCNN().to(device)
optimizer = torch.optim.Adam(convnet2.parameters(), lr=learning_rate)
model = train(convnet2, x_train, y_train, criterion, optimizer, n_epochs=10)
test(model, x_test, y_test)


# Finally ! After changing the optimizer, creating a better CNN architecture and train for a couple of epochs we got an accuracy of over 99% on unseen data.

Expand Down

0 comments on commit 894a1cc

Please sign in to comment.