class_docstr: Base regression model. Models the relationship between a scalar dependent variable y and the independent 
  variables X. 
  Parameters:
  -----------
  n_iterations: float
      The number of training iterations the algorithm will tune the weights for.
  learning_rate: float
      The step length that will be used when updating the weights.
class_docstr_tok: ["Base","regression","model",".","Models","the","relationship","between","a","scalar","dependent","variable","y","and","the","independent","variables","X.","Parameters",":","--","--","--","--","--","-","n_iterations",":","float","The","number","of","training","iterations","the","algorithm","will","tune","the","weights","for",".","learning_rate",":","float","The","step","length","that","will","be","used","when","updating","the","weights","."]
code: def fit(self, X, y):
      # Insert constant ones for bias weights
      X = np.insert(X, 0, 1, axis=1)
      self.training_errors = []
      self.initialize_weights(n_features=X.shape[1])
  
      # Do gradient descent for n_iterations
      for i in range(self.n_iterations):
          y_pred = X.dot(self.w)
          # Calculate l2 loss
          mse = np.mean(
              0.5 * (y - y_pred) ** 2 + self.regularization(self.w)
          )
          self.training_errors.append(mse)
          # Gradient of l2 loss w.r.t w
          grad_w = -(y - y_pred).dot(X) + self.regularization.grad(
              self.w
          )
          # Update the weights
          self.w -= self.learning_rate * grad_w
  
imports: from __future__ import print_function, division
  import numpy
  import math
  from mlfromscratch.utils import normalize, polynomial_features
label_desc: Use image node_id 3 for calling the Regression obj's underlying member method code with example usage: obj.fit(X, y) without return types