code: def _fit(self, X, y, n_vectors):
      n_samples, n_features = X.shape
      loss = self._get_loss()
      penalty = self._get_penalty()
      ds = get_dataset(X)
  
      df = np.zeros((n_samples, n_vectors), dtype=np.float64)
      coef = np.zeros((n_vectors, n_features), dtype=np.float64)
      coefx = coef
      G = np.zeros((n_vectors, n_features), dtype=np.float64)
  
      obj = self._get_regularized_objective(df, y, loss, penalty, coef)
  
      if self.max_steps == 0:
          # No line search, need to use constant step size.
          L = self.C * loss.lipschitz_constant(ds, n_vectors)
      else:
          # Do not bother to compute the Lipschitz constant (expensive).
          L = 1.0
  
      t = 1.0
      for it in range(self.max_iter):
          if self.verbose >= 1:
              print("Iter", it + 1, obj)
  
          # Save current values
          t_old = t
          coefx_old = coefx
  
          # Gradient
          G.fill(0.0)
          loss.gradient(df, ds, y, G)
          G *= self.C
  
          # Line search
          if self.max_steps > 0:
              objb = self._get_objective(df, y, loss)
  
          for tt in range(self.max_steps):
              # Solve
              coefx = coef - G / L
              coefx = penalty.projection(coefx, self.alpha, L)
  
              dfx = safe_sparse_dot(X, coefx.T)
              obj = self._get_regularized_objective(
                  dfx, y, loss, penalty, coefx
              )
              approx = self._get_quad_approx(
                  coefx, coef, objb, G, L, penalty
              )
  
              accepted = obj <= approx
  
              # Sufficient decrease condition
              if accepted:
                  if self.verbose >= 2:
                      print("Accepted at", tt + 1)
                  break
              else:
                  L *= self.eta
  
          if self.max_steps == 0:
              coefx = coef - G / L
              coefx = penalty.projection(coefx, self.alpha, L)
  
          t = (1 + np.sqrt(1 + 4 * t_old * t_old)) / 2
          coef = coefx + (t_old - 1) / t * (coefx - coefx_old)
          df = safe_sparse_dot(X, coef.T)
  
          # Callback might need self.coef_.
          self.coef_ = coef
          if self.callback is not None:
              ret = self.callback(self)
              if ret is not None:
                  break
  
      return self
  
imports: import numpy
  from sklearn.utils.extmath import safe_sparse_dot
  from .base import BaseClassifier, BaseRegressor
  from .dataset_fast import get_dataset
  from .loss_fast import Squared
  from .loss_fast import SquaredHinge
  from .loss_fast import MulticlassSquaredHinge
  from .loss_fast import MulticlassLog
  from .penalty import L1Penalty
  from .penalty import L1L2Penalty
  from .penalty import TracePenalty
  from .penalty import SimplexConstraint
  from .penalty import L1BallConstraint
  from .penalty import TotalVariation1DPenalty
label_desc: Use image node_id 5 for calling the _BaseFista obj's underlying member method code with example usage: obj._fit(X, y, n_vectors) and returns: self