Write a Python function that performs linear regression using gradient descent. The function should take NumPy arrays X (features with a column of ones for the intercept) and y (target) as input, along with the learning rate alpha and the number of iterations. Return the learned coefficients (weights) as a NumPy array.
Minimize the Mean Squared Error (MSE) loss function: where is the prediction and is the number of samples. The factor of 1/2 simplifies the gradient calculation.
Initialize all weights to zero
Use batch gradient descent (use all samples in each iteration)
The input matrix X has shape (m, n) where m is the number of training examples and n is the number of features (including the bias column of ones). The target vector y has shape (m,).