I am beginner in machine learning.ihave problem in gradient descent algo.in the code, mentioned below, my doubt is during
first iteration value of x will be 1
second iteration value of x will be 2
third iteration value of x will be 3
fourth iteration value of x will be 4
fifth iteration value of x will be 5
then what will be the value of x for iterations 6 to 9999???
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def gradient_descent(x,y):
m_curr = b_curr = 0
rate = 0.01
n = len(x)
plt.scatter(x,y,color='red',marker='+',linewidth='5')
for i in range(10000):
y_predicted = m_curr * x + b_curr
plt.plot(x,y_predicted,color='green')
md = -(2/n)*sum(x*(y-y_predicted))
yd = -(2/n)*sum(y-y_predicted)
m_curr = m_curr - rate * md
b_curr = b_curr - rate * yd
x = np.array([1,2,3,4,5])
y = np.array([5,7,9,11,13])
gradient_descent(x,y)