Implementing gradient descent (GD) in Python

Pankaj Kumar
3 min readJan 15, 2022
Photo by Gleb Strelchenko on Unsplash

There are tons of articles to implement gradient descent in python however I wanted to do it in the simplest way possible with minimum coding and still covering all the concepts. We still need to train and test data with usual jargon however I’ am trying to keep the coding and the maths simple.

import numpy as npX = np.array([1,2,3,4])
y = 2*X

x_test = 5

--

--

Pankaj Kumar

MS Data Science SMU TX. Pursuing MSc Financial Engg. At WQU.Interest in Algos, Discovering Trends fm data. Methodical, conven/non-conven. Investigation of data.