(BackBack)
ML//2 min read

Gradient Descent

Gradient descent method is also called as steepest descent method.

Gradient Descent: The What

Gradient descent, also known as the steepest descent method, is a technique to find the values of independent variables that result in the smallest function value. It's like climbing down a mountain (hence the name "descent") by always taking the steepest steps downwards until you reach the lowest point.

Gradient Descent: The Why


We employ gradient descent for several reasons:

  1. It's computationally easier to perform than finding exact differential coefficients.

  2. Real-world problems often deal with complex, non-linear functions whose roots are hard to compute.

  3. When dealing with large datasets, iterative methods like gradient descent can be more efficient.

Gradient Descent: Equation Breakdown

The whole idea behind gradient descent is to use the gradient (or slope) of the function to determine which direction to "step" next. A positive gradient indicates that as our input gets bigger, the function value also gets larger, while a negative gradient implies the opposite.

The core formula of gradient descent is:

xi+1=xidistance×sgn(gradient)x_{i+1}=x_i−distance×sgn(gradient)

xi+1=xiαdfdx(xi)x_{i+1}=x_i−α\frac{df}{dx}(x_i)

Where:

The step size, or α, is used to control how far we travel in each iteration. If the step size is too big, we might overshoot the minimum. If it's too small, it could take too long to find the minimum.

Gradient Descent: Beware the Pitfalls!

There are a couple of things to watch out for when using gradient descent:

Step size

Choosing the correct step size is crucial. If it's too large, you might "jump over" the minimum value. If it's too small, the descent could take forever.

Local Minima

Sometimes, gradient descent can get stuck in a local minimum, a point that's lower than all the nearby points, but not the lowest point overall. To get around this, you can use techniques such as momentum or stochastic gradient descent.

To sum up, gradient descent is an iterative optimization algorithm for finding the minimum of a function. It's widely used in machine learning and data science to minimize cost functions and make predictions more accurate.

And remember, in the world of optimization, choosing the right step size and avoiding local minima is like hiking: it's all about taking the right path and not getting stuck in a valley!