I have been trying to implement a linear regression model on my own with multiple variables.
After implementing it, I see that my loss doesn't decrease.
I think that I'm facing a dimension problem.
Here is my code:
def initialize_parameters(X): n = X.shape return np.random.randn(n,1) def compute_cost(Y,X,W): m = X.shape return (1/2*m) * np.sum(np.power(np.dot(X,W) - Y,2)) def gradient_descent(Y,X,W,epochs,learning_rate): m = X.shape cost_history =  W_temp = W.copy() for i in range(epochs): grads = (learning_rate/m) * np.dot(X.T, np.dot(X,W) -Y) W_temp = W_temp - grads cost = compute_cost(Y,X,W_temp) cost_history.append(cost) return W_temp, cost_history W = initialize_parameters(X_norm) W_best, cost_history = gradient_descent(Y,X_norm,W, 2000, 0.003) plt.plot([i for i in range(2000)], cost_history) plt.show() ```