class_docstr: Randomised CP decomposition via sampled ALS
  
  Parameters
  ----------
  tensor : ndarray
  rank   : int
          number of components
  n_samples : int
              number of samples per ALS step
  n_iter_max : int
              maximum number of iteration
  init : {'svd', 'random'}, optional
  svd : str, default is 'truncated_svd'
      function to use to compute the SVD, acceptable values in tensorly.SVD_FUNS
  tol : float, optional
      tolerance: the algorithm stops when the variation in
      the reconstruction error is less than the tolerance
  max_stagnation: int, optional, default is 0
                  if not zero, the maximum allowed number
                  of iterations with no decrease in fit
  random_state : {None, int, np.random.RandomState}, default is None
  verbose : int, optional
      level of verbosity
  
  Returns
  -------
  factors : ndarray list
          list of positive factors of the CP decomposition
          element `i` is of shape ``(tensor.shape[i], rank)``
  
  References
  ----------
  .. [3] Casey Battaglino, Grey Ballard and Tamara G. Kolda,
     "A Practical Randomized CP Tensor Decomposition",
class_docstr_tok: ["Randomised","CP","decomposition","via","sampled","ALS","Parameters","--","--","--","--","--","tensor",":","ndarray","rank",":","int","number","of","components","n_samples",":","int","number","of","samples","per","ALS","step","n_iter_max",":","int","maximum","number","of","iteration","init",":","{","'svd","'",",","'random","'","}",",","optional","svd",":","str",",","default","is","'truncated_svd'","function","to","use","to","compute","the","SVD",",","acceptable","values","in","tensorly.SVD_FUNS","tol",":","float",",","optional","tolerance",":","the","algorithm","stops","when","the","variation","in","the","reconstruction","error","is","less","than","the","tolerance","max_stagnation",":","int",",","optional",",","default","is","0","if","not","zero",",","the","maximum","allowed","number","of","iterations","with","no","decrease","in","fit","random_state",":","{","None",",","int",",","np.random.RandomState","}",",","default","is","None","verbose",":","int",",","optional","level","of","verbosity","Returns","--","--","--","-","factors",":","ndarray","list","list","of","positive","factors","of","the","CP","decomposition","element","`","i","`","is","of","shape","``","(","tensor.shape","[","i","]",",","rank",")","``","References","--","--","--","--","--","..","[","3","]","Casey","Battaglino",",","Grey","Ballard","and","Tamara","G.","Kolda",",","``","A","Practical","Randomized","CP","Tensor","Decomposition","''",","]
code: def fit_transform(self, tensor):
      self.decomposition_, self.errors_ = randomised_parafac(
          tensor,
          rank=self.rank,
          n_samples=self.n_samples,
          n_iter_max=self.n_iter_max,
          init=self.init,
          svd=self.svd,
          tol=self.tol,
          return_errors=True,
          max_stagnation=self.max_stagnation,
          random_state=self.random_state,
          verbose=self.verbose,
          callback=self.callback,
      )
      return self.decomposition_
  
imports: import numpy
  import warnings
  import tensorly
  from ._base_decomposition import DecompositionMixin
  from ..random import random_cp
  from ..base import unfold
  from ..cp_tensor import cp_to_tensor, CPTensor, cp_norm, cp_normalize, validate_cp_rank
  from ..tenalg.svd import svd_interface
  from ..tenalg import unfolding_dot_khatri_rao
label_desc: Use image node_id 2 for calling the RandomizedCP obj's underlying member method code with example usage: obj.fit_transform(tensor) and returns: self