From 899d0fadd09f67717cfa9200b0c97b53642da129 Mon Sep 17 00:00:00 2001 From: Sean Fuller <54780092+sfuller14@users.noreply.github.com> Date: Wed, 18 Jan 2023 21:46:26 -0800 Subject: [PATCH] Correct loss calc from SSE to MSE in backprop loop SSE is used for loss rather than MSE (~1:54:30 in the video lecture) Using len(ys) for n -- MSE = SSE / n --- lectures/micrograd/micrograd_lecture_second_half_roughly.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/micrograd/micrograd_lecture_second_half_roughly.ipynb b/lectures/micrograd/micrograd_lecture_second_half_roughly.ipynb index 67a25a68..67a2cb41 100644 --- a/lectures/micrograd/micrograd_lecture_second_half_roughly.ipynb +++ b/lectures/micrograd/micrograd_lecture_second_half_roughly.ipynb @@ -1203,7 +1203,7 @@ " \n", " # forward pass\n", " ypred = [n(x) for x in xs]\n", - " loss = sum((yout - ygt)**2 for ygt, yout in zip(ys, ypred))\n", + " loss = sum((yout - ygt)**2 for ygt, yout in zip(ys, ypred)) / len(ys) # Video lecture calculates loss as SSE. Corrected to MSE here.\n", " \n", " # backward pass\n", " for p in n.parameters():\n",