promptdojo_

The training and prediction loop — step 7 of 7

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

A loop isn't done because it ran — it's done when the error stops improving. Rebuild the trainer with a convergence check: an mse(w) helper, then a while-True loop (lr=0.05, start w=0.0) that steps and breaks when the improvement prev_mse - current_mse drops below 1e-9. Print how many steps convergence took, w rounded to 3, and the frozen prediction for x=7 (round 1).

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