lesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction looplesson 3 of 5 · the training and prediction loop
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.
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).