What is Gradient Descent? Math behind Linear Regression | How machine draws a line?| AI with AI

Опубликовано: 09 Июль 2026
на канале: AI with AI
514
13

#gradientdescent #machinelearningalgorithm #linearregression
Gradient descent is an optimization algorithm used to find the values of parameters (coefficients) of a function (f) that minimizes a cost function (cost).

Gradient descent is best used when the parameters cannot be calculated analytically (e.g. using linear algebra) and must be searched for by an optimization algorithm.
Let's understand how the machine draws a best-fitting over the data points using Gradient Descent?

Telegram for more insights(ML papers, PDF and Books):
https://t.me/Artificial_intelligence_AI

Free Code uploaded to GitHub repositry link:
https://github.com/eduai-repo/ML-Demo

Link to Other videos:
Watch below video to understand Linear Regression:-
   • Math behind Linear Regression | Machine Le...  

What is Linear Regression and When to Use it? :-
https://www.youtube.com/watch?v=p3M_i...

Writing First ML algorithm:-
https://www.youtube.com/watch?v=7MJW1...

How to get started in AI:-
https://www.youtube.com/watch?v=p8Ioh...

Types of Machine Learning:-
https://www.youtube.com/watch?v=0ucFy...

All in one Place:
https://linktr.ee/artificial.intellig...

Telegram for more insights(ML papers, PDF's and Books):
https://t.me/Artificial_intelligence_AI

The procedure starts off with initial values for the coefficient or coefficients for the function. These could be 0.0 or a small random value.

coefficient = 0.0

The cost of the coefficients is evaluated by plugging them into the function and calculating the cost.

cost = f(coefficient)

or

cost = evaluate(f(coefficient))

The derivative of the cost is calculated. The derivative is a concept from calculus and refers to the slope of the function at a given point. We need to know the slope so that we know the direction (sign) to move the coefficient values in order to get a lower cost on the next iteration.

delta = derivative(cost)

Now that we know from the derivative which direction is downhill, we can now update the coefficient values. A learning rate parameter (alpha) must be specified that controls how much the coefficients can change on each update.

coefficient = coefficient – (alpha * delta)

This process is repeated until the cost of the coefficients (cost) is 0.0 or close enough to zero to be good enough.