Gradient Descent
メニューを表示するにはスワイプしてください
Gradient Descent is an optimization algorithm that minimizes a function by iteratively adjusting its parameters in the direction of the steepest decrease. It is fundamental in machine learning for enabling models to learn efficiently from data.
Understanding Gradients
The gradient of a function represents the direction and steepness of the function at a given point. It tells us which way to move to minimize the function.
For a simple function:
J(θ)=θ2The derivative (gradient) is:
∇J(θ)=dθd(θ2)=2θThis means that for any value of θ, the gradient tells us how to adjust θ to descend toward the minimum.
Gradient Descent Formula
The weight update rule is:
θ←θ−α∇J(θ)Where:
- θ - model parameter;
- α - learning rate (step size);
- ∇J(θ) - gradient of the function we're aiming to minimize.
For our function:
θnew=θold−α(2θold)This means we update θ iteratively by subtracting the scaled gradient.
Stepwise Movement – A Visual
Example with start values: θ=3, α=0.3
- θ1=3−0.3(2×3)=3−1.8=1.2;
- θ2=1.2−0.3(2×1.2)=1.2−0.72=0.48;
- θ3=0.48−0.3(2×0.48)=0.48−0.288=0.192;
- θ4=0.192−0.3(2×0.192)=0.192−0.115=0.077.
After a few iterations, we move toward θ=0, the minimum.
Learning Rate – Choosing α Wisely
- Too large α - overshoots, never converges;
- Too small α - converges too slowly;
- Optimal α - balances speed & accuracy.
When Does Gradient Descent Stop?
Gradient descent stops when:
∇J(θ)≈0This means that further updates are insignificant and we've found a minimum.
フィードバックありがとうございます!
AIに質問する
AIに質問する
何でも質問するか、提案された質問の1つを試してチャットを始めてください