class_docstr: Sparse coding mixin
class_docstr_tok: ["Sparse","coding","mixin"]
docstr: Encode the data as a sparse combination of the dictionary atoms.
  
  Coding method is determined by the object parameter
  `transform_algorithm`.
  
  Parameters
  ----------
  X : array 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 : array, shape (n_samples, n_components)
      Transformed data
docstr_tok: ["Encode","the","data","as","a","sparse","combination","of","the","dictionary","atoms",".","Coding","method","is","determined","by","the","object","parameter","`","transform_algorithm","`",".","Parameters","--","--","--","--","--","X",":","array","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",":","array",",","shape","(","n_samples",",","n_components",")","Transformed","data"]
code: def transform(self, X, y=None):
      """Encode the data as a sparse combination of the dictionary atoms.
  
      Coding method is determined by the object parameter
      `transform_algorithm`.
  
      Parameters
      ----------
      X : array 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 : array, shape (n_samples, n_components)
          Transformed data
  
      """
      check_is_fitted(self, "components_")
  
      # XXX : kwargs is not documented
      X = check_array(X)
      n_samples, n_features = X.shape
  
      code = sparse_encode(
          X,
          self.components_,
          algorithm=self.transform_algorithm,
          n_nonzero_coefs=self.transform_n_nonzero_coefs,
          alpha=self.transform_alpha,
          n_jobs=self.n_jobs,
      )
  
      if self.split_sign:
          # feature vector is split into a positive and negative side
          n_samples, n_features = code.shape
          split_code = np.empty((n_samples, 2 * n_features))
          split_code[:, :n_features] = np.maximum(code, 0)
          split_code[:, n_features:] = -np.minimum(code, 0)
          code = split_code
  
      return code
  
imports: from __future__ import print_function
  import time
  import sys
  import itertools
  from math import sqrt, ceil
  import numpy
  from scipy import linalg
  from numpy.lib.stride_tricks import as_strided
  from ..base import BaseEstimator, TransformerMixin
  from ..externals.joblib import Parallel, delayed, cpu_count
  from ..externals.six.moves import zip
  from ..utils import check_array, check_random_state, gen_even_slices, gen_batches, _get_n_jobs
  from ..utils.extmath import randomized_svd, row_norms
  from ..utils.validation import check_is_fitted
  from ..linear_model import Lasso, orthogonal_mp_gram, LassoLars, Lars
label_desc: Use image node_id 2 for calling the SparseCodingMixin obj's underlying member method code with example usage: obj.transform(X, y) and returns: code