From 4a08818706f7d32ca22de5ce7fee833f5c503b2c Mon Sep 17 00:00:00 2001 From: udlbook <110402648+udlbook@users.noreply.github.com> Date: Wed, 5 Nov 2025 09:48:13 -0500 Subject: [PATCH] Created using Colab --- Notebooks/Chap06/6_2_Gradient_Descent.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notebooks/Chap06/6_2_Gradient_Descent.ipynb b/Notebooks/Chap06/6_2_Gradient_Descent.ipynb index 1969faa..08731db 100644 --- a/Notebooks/Chap06/6_2_Gradient_Descent.ipynb +++ b/Notebooks/Chap06/6_2_Gradient_Descent.ipynb @@ -301,7 +301,7 @@ "source": [ "def loss_function_1D(dist_prop, data, model, phi_start, search_direction):\n", " # Return the loss after moving this far\n", - " return compute_loss(data[0,:], data[1,:], model, phi_start+ search_direction * dist_prop)\n", + " return compute_loss(data[0,:], data[1,:], model, phi_start - search_direction * dist_prop)\n", "\n", "def line_search(data, model, phi, gradient, thresh=.00001, max_dist = 0.1, max_iter = 15, verbose=False):\n", " # Initialize four points along the range we are going to search\n", @@ -365,7 +365,7 @@ "def gradient_descent_step(phi, data, model):\n", " # TODO -- update Phi with the gradient descent step (equation 6.3)\n", " # 1. Compute the gradient (you wrote this function above)\n", - " # 2. Find the best step size alpha using line search function (above) -- use negative gradient as going downhill\n", + " # 2. Find the best step size alpha using line search function (above)\n", " # 3. Update the parameters phi based on the gradient and the step size alpha.\n", "\n", " return phi"