class_docstr: Base class for SparsePCA and MiniBatchSparsePCA
class_docstr_tok: ["Base","class","for","SparsePCA","and","MiniBatchSparsePCA"]
docstr: Least Squares projection of the data onto the sparse components.
  
  To avoid instability issues in case the system is under-determined,
  regularization can be applied (Ridge regression) via the
  `ridge_alpha` parameter.
  
  Note that Sparse PCA components orthogonality is not enforced as in PCA
  hence one cannot use a simple linear projection.
  
  Parameters
  ----------
  X : ndarray of shape (n_samples, n_features)
      Test data to be transformed, must have the same number of
      features as the data used to train the model.
  
  Returns
  -------
  X_new : ndarray of shape (n_samples, n_components)
      Transformed data.
docstr_tok: ["Least","Squares","projection","of","the","data","onto","the","sparse","components",".","To","avoid","instability","issues","in","case","the","system","is","under-determined",",","regularization","can","be","applied","(","Ridge","regression",")","via","the","`","ridge_alpha","`","parameter",".","Note","that","Sparse","PCA","components","orthogonality","is","not","enforced","as","in","PCA","hence","one","can","not","use","a","simple","linear","projection",".","Parameters","--","--","--","--","--","X",":","ndarray","of","shape","(","n_samples",",","n_features",")","Test","data","to","be","transformed",",","must","have","the","same","number","of","features","as","the","data","used","to","train","the","model",".","Returns","--","--","--","-","X_new",":","ndarray","of","shape","(","n_samples",",","n_components",")","Transformed","data","."]
code: def transform(self, X):
      """Least Squares projection of the data onto the sparse components.
  
      To avoid instability issues in case the system is under-determined,
      regularization can be applied (Ridge regression) via the
      `ridge_alpha` parameter.
  
      Note that Sparse PCA components orthogonality is not enforced as in PCA
      hence one cannot use a simple linear projection.
  
      Parameters
      ----------
      X : ndarray of shape (n_samples, n_features)
          Test data to be transformed, must have the same number of
          features as the data used to train the model.
  
      Returns
      -------
      X_new : ndarray of shape (n_samples, n_components)
          Transformed data.
      """
      check_is_fitted(self)
  
      X = self._validate_data(X, reset=False)
      X = X - self.mean_
  
      U = ridge_regression(
          self.components_.T, X.T, self.ridge_alpha, solver="cholesky"
      )
  
      return U
  
imports: from numbers import Integral, Real
  import numpy
  from ..base import BaseEstimator, ClassNamePrefixFeaturesOutMixin, TransformerMixin, _fit_context
  from ..linear_model import ridge_regression
  from ..utils import check_random_state
  from ..utils._param_validation import Hidden, Interval, StrOptions
  from ..utils.extmath import svd_flip
  from ..utils.validation import check_array, check_is_fitted
  from ._dict_learning import MiniBatchDictionaryLearning, dict_learning
label_desc: Use image node_id 3 for calling the _BaseSparsePCA obj's underlying member method code with example usage: obj.transform(X) and returns: U