promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_promptdojo_

Gradient descent by hand — step 7 of 7

Checkpoint

One last thing before we move on. pass this to mark the lesson done, or skip and keep moving. hop to the next when you're ready.

Automate the decade sweep. run(lr) descends f(w) = (w - 3)² from w=0 for 40 steps (gradient: 2*(w - 3)). For each lr in (0.001, 0.01, 0.1, 1.0) print f"lr={lr:<6} |w - 3| = {err:.6f}", then pick and print the best: f"best lr: {best}". Sweep in decades, read the errors, let the numbers choose.

full-screen editor opens — close anytime to keep reading.