Machine Learning Programs

Gradient Descent program in python


In this article let’s learn how to implement gradient descent in python. Gradient descent is a method of minimizing the cost function by an iterative method. In this method, we assume initial weights(theta) and go on minimizing these weights by learning rate. Here learning rate defines how the weights have to be changed so that the cost function reach the minimum. We go on changing weights until we get minimum value.


  1. Start
  2. Assume initial weights theta1 and theta2 and learning rate.
  3. Find new weights ntheta1 and ntheta2.
  4. Update theta1 and theta2 with computed new theta’s.
  5. Repeat Step 3 and Step 4 until you get minimum value.
  6. Stop.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.