42. Activation Functions, Loss, and Gradient Descent (Plain English)
42.3 Gradient Descent Intuition
42.3 Gradient descent — intuition
Loss माहित असून पुरेसं नाही — weights downhill नेायला हवेत.
हे का शिकायचं?
Why. Loss माहित असून पुरेसं नाही — weights loss surface वर downhill नेायला हवेत. ती walk = gradient descent.
हे काय आहे?
What. Gradient ≈ “loss कुठे fastest वाढते”. Descent उलट दिशेने step: weight := weight − learning_rate × gradient.
कसं करायचं?
How.
Hill story
- तुम्ही धुंद टेकडीवर उभे (loss).
- पायाखालचा slope feel करा (gradient).
- खाली छोटा step (learning rate).
- पुन्हा पुन्हा (epochs / iterations).
# 1D toy: loss = (w - 3)**2 ; true best w is 3
w = 0.0
lr = 0.2
for step in range(8):
grad = 2 * (w - 3) # d/dw of (w-3)^2
w = w - lr * grad
print(step, "w=", round(w, 3), "loss=", round((w-3)**2, 3))
Output / जे दिसायला हवं. w 3 कडे चालतो आणि loss कमी होते. Real nets मध्ये लाखो weights — idea तेच, automated.