Code a custom loss function for a gradient descent optimization problem from scratch.
Implement batch gradient descent for linear regression using the Huber loss. Do not use NumPy, machine learning libraries, or automatic differentiation. Return the learned weight vector, including the intercept as its first element.
The function receives feature rows, targets, learning rate, epoch count, and Huber threshold. Initialize all weights to zero and average gradients across each batch.
def fit_huber_regression(X, y, learning_rate, epochs, delta):