Gradient Descent (GD)
Gradient Descent (GD)
๐น Definition
Gradient Descent is an iterative optimization algorithm used to find the minimum value of a function.
๐ In Machine Learning, it is used to:
- Minimize the loss (cost) function
- Find optimal model parameters (coefficients)
๐น Key Idea
๐ Move step-by-step in the direction where the function decreases fastest.
- Gradient = slope of the function
- We move in the opposite direction of the gradient
๐น 3. Mathematical Update Rule
Where:
- → parameter (coefficient)
- → learning rate
- → gradient of cost function
๐นSteps of Gradient Descent
- Initialize parameters (random or zero)
- Compute cost function
- Calculate gradient (derivative)
-
Update parameters:
- Repeat until minimum is reached
Image credit: towards data science
๐น Conditions for Gradient Descent
Function should be:
- ✅ Differentiable → derivative must exist
- ✅ Convex → ensures global minimum
๐น Learning Rate (ฮฑ)
๐ Controls step size
| Learning Rate | Effect |
|---|---|
| Too small | Slow convergence |
| Too large | May diverge |
| Optimal | Fast convergence |
๐นCost Function (Example: Linear Regression)
๐ GD minimizes this error
๐น Intuition
- Think of rolling a ball downhill
- It moves step-by-step to reach the lowest point
๐น When to Use
- Large datasets
- When closed-form solution (normal equation) is expensive
-
Used in:
- Linear regression
- Neural networks
- Deep learning
๐น Advantages
- Simple and easy to implement
- Works well for large data
๐น Limitations
- Can get stuck in local minima (non-convex case)
- Sensitive to learning rate
- Requires tuning
๐นSummary Formula
๐ Quick Revision
- Gradient = slope
- Move opposite direction
- Repeat until minimum
- Learning rate is critical

Comments
Post a Comment