class_docstr: CP tensor regression
  
  Learns a low rank CP tensor weight, This performs a partial least square regression to a tensor X (>= 2 modes)
  against a matrix Y. The first modes of X and Y will be considered coupled, and the decomposition will maximize
  the covariance between them.
  
  Parameters
  ----------
  n_components : int
      rank of the CP decomposition of the regression weights
  tol : float
      convergence value
  n_iter_max : int, optional, default is 100
      maximum number of iteration
  random_state : None, int or RandomState, optional, default is None
  verbose : bool, default is False
      whether to be verbose during fitting
  
  References
  ----------
  .. [1] Rasmus Bro, "Multiway calibration. Multilinear PLS", Chemometrics, 1996
class_docstr_tok: ["CP","tensor","regression","Learns","a","low","rank","CP","tensor","weight",",","This","performs","a","partial","least","square","regression","to","a","tensor","X","(",">","=","2","modes",")","against","a","matrix","Y",".","The","first","modes","of","X","and","Y","will","be","considered","coupled",",","and","the","decomposition","will","maximize","the","covariance","between","them",".","Parameters","--","--","--","--","--","n_components",":","int","rank","of","the","CP","decomposition","of","the","regression","weights","tol",":","float","convergence","value","n_iter_max",":","int",",","optional",",","default","is","100","maximum","number","of","iteration","random_state",":","None",",","int","or","RandomState",",","optional",",","default","is","None","verbose",":","bool",",","default","is","False","whether","to","be","verbose","during","fitting","References","--","--","--","--","--","..","[","1","]","Rasmus","Bro",",","``","Multiway","calibration",".","Multilinear","PLS","''",",","Chemometrics",",","1996"]
docstr: Learn and apply the dimension reduction on the train data.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      Training vectors, where `n_samples` is the number of samples and
      `n_features` is the number of predictors.
  y : array-like of shape (n_samples, n_targets), default=None
      Target vectors, where `n_samples` is the number of samples and
      `n_targets` is the number of response variables.
  
  Returns
  -------
  self : ndarray of shape (n_samples, n_components)
      Return `x_scores` if `Y` is not given, `(x_scores, y_scores)` otherwise.
docstr_tok: ["Learn","and","apply","the","dimension","reduction","on","the","train","data",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","Training","vectors",",","where","`","n_samples","`","is","the","number","of","samples","and","`","n_features","`","is","the","number","of","predictors",".","y",":","array-like","of","shape","(","n_samples",",","n_targets",")",",","default=None","Target","vectors",",","where","`","n_samples","`","is","the","number","of","samples","and","`","n_targets","`","is","the","number","of","response","variables",".","Returns","--","--","--","-","self",":","ndarray","of","shape","(","n_samples",",","n_components",")","Return","`","x_scores","`","if","`","Y","`","is","not","given",",","`","(","x_scores",",","y_scores",")","`","otherwise","."]
code: def fit_transform(self, X, Y):
      """Learn and apply the dimension reduction on the train data.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Training vectors, where `n_samples` is the number of samples and
          `n_features` is the number of predictors.
      y : array-like of shape (n_samples, n_targets), default=None
          Target vectors, where `n_samples` is the number of samples and
          `n_targets` is the number of response variables.
  
      Returns
      -------
      self : ndarray of shape (n_samples, n_components)
          Return `x_scores` if `Y` is not given, `(x_scores, y_scores)` otherwise.
      """
      return self.fit(X, Y).transform(X, Y)
  
file_path: tensorly/tensorly/regression/cp_plsr.py
imports: from ..tenalg import multi_mode_dot, outer
  from ..None import backend
  from ..None import tensor_to_vec
  from ..decomposition._cp import initialize_cp
label_desc: Use image node_id 7 for calling the CP_PLSR obj's underlying member method code with example usage: obj.fit_transform(X, Y) and returns: self