From 03cde26d89da9d0377d882eb58c9fa41207147b1 Mon Sep 17 00:00:00 2001 From: Gaston Maffei Date: Sat, 6 Feb 2021 17:30:05 -0300 Subject: [PATCH] loss was off by factor 10 --- mnist_from_scratch.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mnist_from_scratch.ipynb b/mnist_from_scratch.ipynb index a07fe17..df182fa 100644 --- a/mnist_from_scratch.ipynb +++ b/mnist_from_scratch.ipynb @@ -325,7 +325,7 @@ " x_relu = np.maximum(x_l1, 0)\n", " x_l2 = x_relu.dot(l2)\n", " x_lsm = x_l2 - logsumexp(x_l2).reshape((-1, 1))\n", - " x_loss = (-out * x_lsm).mean(axis=1)\n", + " x_loss = -x_lsm[np.arange(x_lsm.shape[0]), y]\n", "\n", " # training in numpy (super hard!)\n", " # backward pass\n", @@ -545,7 +545,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.6" + "version": "3.8.5" } }, "nbformat": 4,