class_docstr: A class wrapper for the tensor_ring_als function
  
  Attributes
  ----------
  rank : Union[int, List[int]]
      The rank of the decomposition. If `rank` is an int, then all ranks will be the
      same and equal to `rank`. If `rank` is a list, then the i-th core will be of
      size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dimension of the
      i-th mode of `tensor`.
  ls_solve : {"lstsq", "normal_eq"}
      When equal to "lstsq", the least squares problems are solved as overdetermined
      systems of equations using tl.lstsq. When equal to "normal_eq", a normal
      equation formulation is used instead together with tl.solve. This latter
      approach is expected to yield poorer accuracy due to numerical issuse with the
      normal equations.
  n_iter_max : int
      Maximum number of ALS iterations.
  tol : float
      The algorithm is terminated when the change in the relative reconstruction error
      is less than `tol`.
  random_state : {None, int, np.random.RandomState}
      Used to set the random seed in the algorithm.
  verbose : bool
      If True, the algorithm will make some additional print outs.
  callback : {None, Callable[[tl.tr_tensor.TRTensor, float], {None, bool}]}
      A callback function which can be used for, e.g., logging the per-iteration
      error. Such a function takes two inputs: A tensor ring decomposition and a float
      which indicates the relative reconstruction error between `tensor` and the
      inputted TRTensor. It can return a bool which can be used to control when the
      ALS algorithm terminates.
  
  Methods
  -------
  fit_transformation(tensor)
      Computes the decomposition of `tensor`.
class_docstr_tok: ["A","class","wrapper","for","the","tensor_ring_als","function","Attributes","--","--","--","--","--","rank",":","Union","[","int",",","List","[","int","]","]","The","rank","of","the","decomposition",".","If","`","rank","`","is","an","int",",","then","all","ranks","will","be","the","same","and","equal","to","`","rank","`",".","If","`","rank","`","is","a","list",",","then","the","i-th","core","will","be","of","size","rank","[","i","]","-by-shape","[","i","]","-by-rank","[","i+1","]",",","where","shape","[","i","]","is","the","dimension","of","the","i-th","mode","of","`","tensor","`",".","ls_solve",":","{","``","lstsq","''",",","``","normal_eq","''","}","When","equal","to","``","lstsq","''",",","the","least","squares","problems","are","solved","as","overdetermined","systems","of","equations","using","tl.lstsq",".","When","equal","to","``","normal_eq","''",",","a","normal","equation","formulation","is","used","instead","together","with","tl.solve",".","This","latter","approach","is","expected","to","yield","poorer","accuracy","due","to","numerical","issuse","with","the","normal","equations",".","n_iter_max",":","int","Maximum","number","of","ALS","iterations",".","tol",":","float","The","algorithm","is","terminated","when","the","change","in","the","relative","reconstruction","error","is","less","than","`","tol","`",".","random_state",":","{","None",",","int",",","np.random.RandomState","}","Used","to","set","the","random","seed","in","the","algorithm",".","verbose",":","bool","If","True",",","the","algorithm","will","make","some","additional","print","outs",".","callback",":","{","None",",","Callable","[","[","tl.tr_tensor.TRTensor",",","float","]",",","{","None",",","bool","}","]","}","A","callback","function","which","can","be","used","for",",","e.g.",",","logging","the","per-iteration","error",".","Such","a","function","takes","two","inputs",":","A","tensor","ring","decomposition","and","a","float","which","indicates","the","relative","reconstruction","error","between","`","tensor","`","and","the","inputted","TRTensor",".","It","can","return","a","bool","which","can","be","used","to","control","when","the","ALS","algorithm","terminates",".","Methods","--","--","--","-","fit_transformation","(","tensor",")","Computes","the","decomposition","of","`","tensor","`","."]
docstr: Parameters
  ----------
  rank : Union[int, List[int]]
      The rank of the decomposition. If `rank` is an int, then all ranks will be the
      same and equal to `rank`. If `rank` is a list, then the i-th core will be of
      size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dimension of the
      i-th mode of `tensor`.
  ls_solve : {"lstsq", "normal_eq"}, default is "lstsq"
      When equal to "lstsq", the least squares problems are solved as overdetermined
      systems of equations using tl.lstsq. When equal to "normal_eq", a normal
      equation formulation is used instead together with tl.solve. This latter
      approach is expected to yield poorer accuracy due to numerical issuse with the
      normal equations.
  n_iter_max : int, default is 100
      Maximum number of ALS iterations.
  tol : float, default 1e-6
      The algorithm is terminated when the change in the relative reconstruction error
      is less than `tol`.
  random_state : {None, int, np.random.RandomState}
      Used to set the random seed in the algorithm.
  verbose : bool, default False
      If True, the algorithm will make some additional print outs.
  callback : {None, Callable[[tl.tr_tensor.TRTensor, float], {None, bool}]}, default None
      A callback function which can be used for, e.g., logging the per-iteration
      error. Such a function takes two inputs: A tensor ring decomposition and a float
      which indicates the relative reconstruction error between `tensor` and the
      inputted TRTensor. It can return a bool which can be used to control when the
      ALS algorithm terminates.
docstr_tok: ["Parameters","--","--","--","--","--","rank",":","Union","[","int",",","List","[","int","]","]","The","rank","of","the","decomposition",".","If","`","rank","`","is","an","int",",","then","all","ranks","will","be","the","same","and","equal","to","`","rank","`",".","If","`","rank","`","is","a","list",",","then","the","i-th","core","will","be","of","size","rank","[","i","]","-by-shape","[","i","]","-by-rank","[","i+1","]",",","where","shape","[","i","]","is","the","dimension","of","the","i-th","mode","of","`","tensor","`",".","ls_solve",":","{","``","lstsq","''",",","``","normal_eq","''","}",",","default","is","``","lstsq","''","When","equal","to","``","lstsq","''",",","the","least","squares","problems","are","solved","as","overdetermined","systems","of","equations","using","tl.lstsq",".","When","equal","to","``","normal_eq","''",",","a","normal","equation","formulation","is","used","instead","together","with","tl.solve",".","This","latter","approach","is","expected","to","yield","poorer","accuracy","due","to","numerical","issuse","with","the","normal","equations",".","n_iter_max",":","int",",","default","is","100","Maximum","number","of","ALS","iterations",".","tol",":","float",",","default","1e-6","The","algorithm","is","terminated","when","the","change","in","the","relative","reconstruction","error","is","less","than","`","tol","`",".","random_state",":","{","None",",","int",",","np.random.RandomState","}","Used","to","set","the","random","seed","in","the","algorithm",".","verbose",":","bool",",","default","False","If","True",",","the","algorithm","will","make","some","additional","print","outs",".","callback",":","{","None",",","Callable","[","[","tl.tr_tensor.TRTensor",",","float","]",",","{","None",",","bool","}","]","}",",","default","None","A","callback","function","which","can","be","used","for",",","e.g.",",","logging","the","per-iteration","error",".","Such","a","function","takes","two","inputs",":","A","tensor","ring","decomposition","and","a","float","which","indicates","the","relative","reconstruction","error","between","`","tensor","`","and","the","inputted","TRTensor",".","It","can","return","a","bool","which","can","be","used","to","control","when","the","ALS","algorithm","terminates","."]
code: def __init__(
      self,
      rank,
      ls_solve="lstsq",
      n_iter_max=100,
      tol=1e-6,
      random_state=None,
      verbose=False,
      callback=None,
  ):
      """
      Parameters
      ----------
      rank : Union[int, List[int]]
          The rank of the decomposition. If `rank` is an int, then all ranks will be the
          same and equal to `rank`. If `rank` is a list, then the i-th core will be of
          size rank[i]-by-shape[i]-by-rank[i+1], where shape[i] is the dimension of the
          i-th mode of `tensor`.
      ls_solve : {"lstsq", "normal_eq"}, default is "lstsq"
          When equal to "lstsq", the least squares problems are solved as overdetermined
          systems of equations using tl.lstsq. When equal to "normal_eq", a normal
          equation formulation is used instead together with tl.solve. This latter
          approach is expected to yield poorer accuracy due to numerical issuse with the
          normal equations.
      n_iter_max : int, default is 100
          Maximum number of ALS iterations.
      tol : float, default 1e-6
          The algorithm is terminated when the change in the relative reconstruction error
          is less than `tol`.
      random_state : {None, int, np.random.RandomState}
          Used to set the random seed in the algorithm.
      verbose : bool, default False
          If True, the algorithm will make some additional print outs.
      callback : {None, Callable[[tl.tr_tensor.TRTensor, float], {None, bool}]}, default None
          A callback function which can be used for, e.g., logging the per-iteration
          error. Such a function takes two inputs: A tensor ring decomposition and a float
          which indicates the relative reconstruction error between `tensor` and the
          inputted TRTensor. It can return a bool which can be used to control when the
          ALS algorithm terminates.
      """
  
      self.rank = rank
      self.ls_solve = ls_solve
      self.n_iter_max = n_iter_max
      self.tol = tol
      self.random_state = random_state
      self.verbose = verbose
      self.callback = callback
  
file_path: tensorly/tensorly/decomposition/_tr.py
imports: import tensorly
  from ._base_decomposition import DecompositionMixin
  from ..base import matricize
  from ..tr_tensor import validate_tr_rank, TRTensor
  from ..tenalg.svd import svd_interface
label_desc: Use image node_id 1 to create a new TensorRingALS object from inherited base classes: DecompositionMixin with example: obj = TensorRingALS(rank, ls_solve, n_iter_max, tol, random_state, verbose, callback)