Last time, Robo predicted 80 cups, but we sold 100. The Error was 20.
Robo's brain "Weight" (2.0) was too small. We need to Nudge it up! This process is called Training.
When the guess is too low (Error is positive), we add a tiny bit to the weight.
We do this over and over until the Error is zero. That's how computers "learn"!
Start with our old weight (2.0). Calculate prediction and error for temp=40, actual=100.
temp = 40
weight = 2.0
pred = temp * weight
error = 100 - pred
print("Old Error:", error)
Since error (20) is positive, let's increase the weight by roughly 0.5 to get closer.
weight = weight + 0.5
print("New Weight:", weight)
Now calculate the new_pred and new_error with the updated weight.
new_pred = temp * weight
new_error = 100 - new_pred
print("New Error:", new_error)
1. If the error was NEGATIVE (we guessed too high), what should we do to the weight?