**Table of Contents**

What is Gradient Descent?

Concept

Example

Video Tutorial

**1 What is Gradient Descent?**

In this blog we’ll be looking at a very important concept of error handling known as a gradient descent and the concept behind it. Now the image that we have in front of you is a three-dimensional image of a gradient descent.

It specifically means that which you are having as the global minimum is the point where you’rehaving the minimum error. Now your machine learning model can have any of the error values starting from any point and the objective that you have in your machine learning model is to get to that minimum error

**2 Concept**

Now the two major approaches to attain the global minima are either by taking a very big leap or very big rate or very big step to reach the global minima or by taking on a very small steps to reach the same.

- The problem with a very big step is you might not go to the minimaand you might end up on a negative side. The problem with the very small rate is that those rates get smaller and smaller each and every time and as it approaches to the global minima it increases on an infinitely many small steps allowing you to never reach the global minima.
- So, to handle that we use something known as targeted gradient descent. In which you need to take a very specific step in according to the model that allows you to reach global minima in a very fast rate.

**3 Example**

- Firstly, we are loading the bank data using pandas
- Then import necessary libraries here weare importing the K fold library from sklearn_cv module.
- We pass the number of folds and number of iterations and shuffling with‘False’.
- Now we save each and every amount of step data to validate init’s training or testing period.
- The data being saved and not seen by the machine learning model allows it to evaluate it properly.

we can look at the image with the training data and testing observations that we want over the iteration for K fold over a time.

- we can see the accuracy of the model and in the first iteration we have an accuracy of 100% followed by the 93 percent and so on.
- So, the concept of k-fold is very essential for gradient descent.we can also refer the documentation in sklearn model selection and kfold library.