From f8878356460d54fbea41565b8070a3c17f24a842 Mon Sep 17 00:00:00 2001 From: udlbook <110402648+udlbook@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:18:12 -0400 Subject: [PATCH] Created using Colab --- Notebooks/Chap06/6_2_Gradient_Descent.ipynb | 26 +++++++-------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Notebooks/Chap06/6_2_Gradient_Descent.ipynb b/Notebooks/Chap06/6_2_Gradient_Descent.ipynb index 21a96bb..c28d51a 100644 --- a/Notebooks/Chap06/6_2_Gradient_Descent.ipynb +++ b/Notebooks/Chap06/6_2_Gradient_Descent.ipynb @@ -1,18 +1,16 @@ { "cells": [ { - "attachments": {}, "cell_type": "markdown", "metadata": { - "colab_type": "text", - "id": "view-in-github" + "id": "view-in-github", + "colab_type": "text" }, "source": [ "\"Open" ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "el8l05WQEO46" @@ -111,7 +109,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "QU5mdGvpTtEG" @@ -140,7 +137,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "eB5DQvU5hYNx" @@ -162,7 +158,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "F3trnavPiHpH" @@ -218,7 +213,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "s9Duf05WqqSC" @@ -252,7 +246,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "RS1nEcYVuEAM" @@ -290,7 +283,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "5EIjMM9Fw2eT" @@ -333,11 +325,11 @@ " print('Iter %d, a=%3.3f, b=%3.3f, c=%3.3f, d=%3.3f'%(n_iter, a,b,c,d))\n", " print('a %f, b%f, c%f, d%f'%(lossa,lossb,lossc,lossd))\n", "\n", - " # Rule #1 If point A is less than points B, C, and D then halve points B,C, and D\n", + " # Rule #1 If point A is less than points B, C, and D then halve distance from A to points B,C, and D\n", " if np.argmin((lossa,lossb,lossc,lossd))==0:\n", - " b = b/2\n", - " c = c/2\n", - " d = d/2\n", + " b = a+ (b-a)/2\n", + " c = a+ (c-a)/2\n", + " d = a+ (d-a)/2\n", " continue;\n", "\n", " # Rule #2 If point b is less than point c then\n", @@ -412,8 +404,8 @@ ], "metadata": { "colab": { - "include_colab_link": true, - "provenance": [] + "provenance": [], + "include_colab_link": true }, "kernelspec": { "display_name": "Python 3", @@ -425,4 +417,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file