Skip to content

Commit 3a56f48

Browse files
committed
Add explanation for using boolean to count correct predictions
1 parent 224878b commit 3a56f48

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

intro-neural-networks/gradient-descent/GradientDescent.ipynb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@
154154
" else:\n",
155155
" print(\"Train loss: \", loss)\n",
156156
" last_loss = loss\n",
157+
" \n",
158+
" # Converting the output (float) to boolean as it is a binary classification\n",
159+
" # e.g. 0.95 --> True (= 1), 0.31 --> False (= 0)\n",
157160
" predictions = out > 0.5\n",
161+
" \n",
158162
" accuracy = np.mean(predictions == targets)\n",
159163
" print(\"Accuracy: \", accuracy)\n",
160164
" if graph_lines and e % (epochs / 100) == 0:\n",

0 commit comments

Comments
 (0)