42. Activation Functions, Loss, and Gradient Descent (Plain English)
42.4 Learning Rate Simply
Why. Learning rate too big → overshoot. Too small → snail training.
What. Learning rate (lr) is the step size. Beginners start with values like 0.1, 0.01, 0.001 and watch the loss curve.
How.
Compare two lrs on the toy
- Rerun the Chapter 42.3 loop with lr=1.5 (often unstable).
- Rerun with lr=0.01 (slow but steady).
- Prefer steady drop of loss over wild jumps.
def walk(lr, steps=6):
w = 0.0
hist = []
for _ in range(steps):
w = w - lr * 2 * (w - 3)
hist.append(round(w, 3))
return hist
print("lr=0.2", walk(0.2))
print("lr=1.5", walk(1.5))
Ravindra Bagale's Tip
If the loss graph suddenly jumps up (a spike), make the learning rate (lr) smaller and run it again. Small, patient steps usually train better than huge steps.
Ravindra Bagale's Tip – मराठी
Loss graph मध्ये अचानक spike दिसला, तर learning rate (lr) कमी करा आणि पुन्हा run करा. खूप मोठ्या steps पेक्षा छोटे आणि संयमाने घेतलेले steps साधारणपणे चांगलं training देतात.
Ravindra Bagale's Tip – हिंदी
अगर loss graph में अचानक spike दिखे, तो learning rate (lr) कम करो और फिर से run करो. बहुत बड़े steps के बजाय छोटे और धैर्य वाले steps से training आमतौर पर बेहतर होती है.