Gradient Descent, Linear Regression, Machine Learning.
gradient_descent(X, y, lr=0.05, epoch=10): ''' Gradient Descent for a single feature ''' m, b = 0.33, 0.48 # parameters log, mse = [], [] # lists to store learning process N = len(X) # number of samples for _ in range(epoch): f = y - (m*X + b) # Updating m and b m -= lr * (-2 * X.dot(f).sum() / N)