From e1df2156a3e18f2a386cf71a78daffa8e470f952 Mon Sep 17 00:00:00 2001 From: udlbook <110402648+udlbook@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:19:49 -0400 Subject: [PATCH] Created using Colab --- .../6_3_Stochastic_Gradient_Descent.ipynb | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/Notebooks/Chap06/6_3_Stochastic_Gradient_Descent.ipynb b/Notebooks/Chap06/6_3_Stochastic_Gradient_Descent.ipynb index 51b50557..ce846893 100644 --- a/Notebooks/Chap06/6_3_Stochastic_Gradient_Descent.ipynb +++ b/Notebooks/Chap06/6_3_Stochastic_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" @@ -122,7 +120,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "QU5mdGvpTtEG" @@ -150,7 +147,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "eB5DQvU5hYNx" @@ -172,7 +168,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "F3trnavPiHpH" @@ -228,7 +223,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "s9Duf05WqqSC" @@ -279,7 +273,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "RS1nEcYVuEAM" @@ -316,7 +309,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "metadata": { "id": "5EIjMM9Fw2eT" @@ -359,11 +351,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 change B,C,D so they are half their current distance from A\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", @@ -577,9 +569,8 @@ ], "metadata": { "colab": { - "authorship_tag": "ABX9TyNk5FN4qlw3pk8BwDVWw1jN", - "include_colab_link": true, - "provenance": [] + "provenance": [], + "include_colab_link": true }, "kernelspec": { "display_name": "Python 3", @@ -591,4 +582,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} +} \ No newline at end of file