ageron / ageron/handson-ml

Ch 4: batch gradient descent demonstration with various learning rates

Open
#446 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
25.6k
Forks
12.7k
PR merge metrics
No merged PRs in 30d

Description

Hi Aurelien.

May I modestly suggest the attached implementation of the plot_gradient_descent() function?
I think it drives home your point:

>A simple solution is to set a very large number of iterations but to interrupt the algorithm when the gradient vector becomes tiny...

It also demonstrates how to actually calculate the magnitude of a vector.

Lastly, I also took the liberty of plotting the final predictions - may be good for the illustrative purposes, since it won't show up on the third plot, which corresponds to the LR that is too high.

Cheers!
Gene.

[plot_gd.txt](https://github.com/ageron/handson-ml/files/3268865/plot_gd.txt)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.