Machine Learning, Python, Linear Regression, Gradient Descent, Regression Analysis.
# intercept # random initialization theta = np.random.randn(2, 1) lr = 0.1 # learning rate num_iters = 100 # number of iterations theta, cost_history, theta_history = calc_gradient_descent(X_b, y, theta, lr, num_iters) # plot the costs plt.plot(range(num_iters), cost_history)