Skip to content

Instantly share code, notes, and snippets.

View bgreatfit's full-sized avatar
🎯
Focusing

Micheal Ojemoron bgreatfit

🎯
Focusing
View GitHub Profile
@bgreatfit
bgreatfit / art2gd.py
Created October 7, 2018 04:45
Gradient Descent
#gradient descent
def gradientDescent(X,y,theta,iters,alpha):
cost = np.zeros(iters)
for i in range(iters):
theta = theta - (alpha/len(X)) * np.sum(X * (X @ theta.T - y), axis=0)
cost[i] = computeCost(X, y, theta)
return theta,cost
#running the gd and cost function