How a Machine Learns: Reducing Error
Learning is trial and error with feedback. The model makes a guess, a loss number measures how wrong it is, and a small change is made to the model to reduce the loss. Repeat thousands of times. Moving in the direction that lowers the loss is called gradient descent.
Here is a one-number model: guess the multiplier w in y = w * x from examples where the true rule is y = 3x.
Examplepython
Quick check
What does the loss measure?
Your turn: write the code
Run 20 steps of the same learning loop and print w rounded to 2 decimals.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.