Algorithm · Amazon · Medium
Implement a vectorized batch gradient descent algorithm, in Python-like pseudocode, for linear regression with an intercept term. The feature matrix X has shape $$m \times n$$ and already contains a leading column of ones for the intercept. The target vector y has length $$m$$. The routine must accept X, y, learning_rate ($$\alpha$$), max_iters, and tolerance; it must return the fitted parameter vector theta of length $$n$$ and a list cost_history. Initialize theta to the…
Checking your access…