class_docstr: Estimator for learning linear regressors by (block) coordinate descent.
  
  The objective functions considered take the form
  
  minimize F(W) = C * L(W) + alpha * R(W),
  
  where L(W) is a loss term and R(W) is a penalty term.
  
  Parameters
  ----------
  loss : str, 'squared'
      The loss function to be used.
  
  penalty : str, 'l2', 'l1', 'l1/l2'
      The penalty to be used.
  
      - l2: ridge
      - l1: lasso
      - l1/l2: group lasso
  
  For other parameters, see `CDClassifier`.
class_docstr_tok: ["Estimator","for","learning","linear","regressors","by","(","block",")","coordinate","descent",".","The","objective","functions","considered","take","the","form","minimize","F","(","W",")","=","C","*","L","(","W",")","+","alpha","*","R","(","W",")",",","where","L","(","W",")","is","a","loss","term","and","R","(","W",")","is","a","penalty","term",".","Parameters","--","--","--","--","--","loss",":","str",",","'squared'","The","loss","function","to","be","used",".","penalty",":","str",",","'l2","'",",","'l1","'",",","'l1\/l2'","The","penalty","to","be","used",".","-","l2",":","ridge","-","l1",":","lasso","-","l1\/l2",":","group","lasso","For","other","parameters",",","see","`","CDClassifier","`","."]
docstr: Fit model according to X and y.
  
  Parameters
  ----------
  X : array-like, shape = [n_samples, n_features]
      Training vectors, where n_samples is the number of samples
      and n_features is the number of features.
  
  y : array-like, shape = [n_samples] or [n_samples, n_targets]
      Target values.
  
  Returns
  -------
  self : regressor
      Returns self.
docstr_tok: ["Fit","model","according","to","X","and","y.","Parameters","--","--","--","--","--","X",":","array-like",",","shape","=","[","n_samples",",","n_features","]","Training","vectors",",","where","n_samples","is","the","number","of","samples","and","n_features","is","the","number","of","features",".","y",":","array-like",",","shape","=","[","n_samples","]","or","[","n_samples",",","n_targets","]","Target","values",".","Returns","--","--","--","-","self",":","regressor","Returns","self","."]
code: def fit(self, X, y):
      """Fit model according to X and y.
  
      Parameters
      ----------
      X : array-like, shape = [n_samples, n_features]
          Training vectors, where n_samples is the number of samples
          and n_features is the number of features.
  
      y : array-like, shape = [n_samples] or [n_samples, n_targets]
          Target values.
  
      Returns
      -------
      self : regressor
          Returns self.
      """
      rs = self._get_random_state()
  
      # Create dataset
      ds = get_dataset(X, order="fortran")
      n_features = ds.get_n_features()
  
      self.outputs_2d_ = len(y.shape) == 2
      if self.outputs_2d_:
          Y = y
      else:
          Y = y.reshape(-1, 1)
      Y = np.asfortranarray(Y, dtype=np.float64)
      y = np.empty(0, dtype=np.int32)
      n_vectors = Y.shape[1]
  
      # Initialize coefficients
      if not self.warm_start or self.coef_ is None:
          self.C_init = self.C
          self.coef_ = np.zeros(
              (n_vectors, n_features), dtype=np.float64
          )
          self._init_errors(Y)
  
      self.intercept_ = np.zeros(n_vectors, dtype=np.float64)
      indices = np.arange(n_features, dtype=np.int32)
  
      if self.penalty == "l1/l2":
          vinit = self.violation_init_.get(0, 0) * self.C / self.C_init
          model = _primal_cd(
              self,
              self.coef_,
              self.errors_,
              ds,
              y,
              Y,
              -1,
              False,
              indices,
              12,
              self._get_loss(),
              self.selection,
              self.permute,
              self.termination,
              self.C,
              self.alpha,
              self.max_iter,
              self.max_steps,
              self.shrinking,
              vinit,
              rs,
              self.tol,
              self.callback,
              self.n_calls,
              self.verbose,
          )
          viol = model[0]
          if self.warm_start and len(self.violation_init_) == 0:
              self.violation_init_[0] = viol
      else:
          penalty = self._get_penalty()
          vinit = (
              np.asarray(
                  [
                      self.violation_init_.get(k, 0)
                      for k in range(n_vectors)
                  ]
              )
              * self.C
              / self.C_init
          )
  
          jobs = (
              delayed(_primal_cd)(
                  self,
                  self.coef_,
                  self.errors_,
                  ds,
                  y,
                  Y,
                  k,
                  False,
                  indices,
                  penalty,
                  self._get_loss(),
                  self.selection,
                  self.permute,
                  self.termination,
                  self.C,
                  self.alpha,
                  self.max_iter,
                  self.max_steps,
                  self.shrinking,
                  vinit[k],
                  rs,
                  self.tol,
                  self.callback,
                  self.n_calls,
                  self.verbose,
              )
              for k in range(n_vectors)
          )
  
          model = Parallel(n_jobs=self.n_jobs, verbose=self.verbose)(
              jobs
          )
          viol, self.coef_, self.error_ = zip(*model)
          self.coef_ = np.asarray(self.coef_)
          self.error_ = np.asarray(self.error_)
  
          if self.warm_start and not n_vectors in self.violation_init_:
              self.violation_init_[n_vectors] = viol
  
      return self
  
imports: import numpy
  from joblib import Parallel, delayed
  from .base import BaseClassifier
  from .base import BaseRegressor
  from .dataset_fast import get_dataset
  from .primal_cd_fast import _primal_cd
  from .primal_cd_fast import Squared
  from .primal_cd_fast import SmoothHinge
  from .primal_cd_fast import SquaredHinge
  from .primal_cd_fast import ModifiedHuber
  from .primal_cd_fast import Log
label_desc: Use image node_id 2 for calling the CDRegressor obj's underlying member method code with example usage: obj.fit(X, y) and returns: self