class_docstr: PLS regression.
  
  PLSRegression is also known as PLS2 or PLS1, depending on the number of
  targets.
  
  Read more in the :ref:`User Guide <cross_decomposition>`.
  
  .. versionadded:: 0.8
  
  Parameters
  ----------
  n_components : int, default=2
      Number of components to keep. Should be in `[1, min(n_samples,
      n_features, n_targets)]`.
  
  scale : bool, default=True
      Whether to scale `X` and `Y`.
  
  max_iter : int, default=500
      The maximum number of iterations of the power method when
      `algorithm='nipals'`. Ignored otherwise.
  
  tol : float, default=1e-06
      The tolerance used as convergence criteria in the power method: the
      algorithm stops whenever the squared norm of `u_i - u_{i-1}` is less
      than `tol`, where `u` corresponds to the left singular vector.
  
  copy : bool, default=True
      Whether to copy `X` and `Y` in :term:`fit` before applying centering,
      and potentially scaling. If `False`, these operations will be done
      inplace, modifying both arrays.
  
  Attributes
  ----------
  x_weights_ : ndarray of shape (n_features, n_components)
      The left singular vectors of the cross-covariance matrices of each
      iteration.
  
  y_weights_ : ndarray of shape (n_targets, n_components)
      The right singular vectors of the cross-covariance matrices of each
      iteration.
  
  x_loadings_ : ndarray of shape (n_features, n_components)
      The loadings of `X`.
  
  y_loadings_ : ndarray of shape (n_targets, n_components)
      The loadings of `Y`.
  
  x_scores_ : ndarray of shape (n_samples, n_components)
      The transformed training samples.
  
  y_scores_ : ndarray of shape (n_samples, n_components)
      The transformed training targets.
  
  x_rotations_ : ndarray of shape (n_features, n_components)
      The projection matrix used to transform `X`.
  
  y_rotations_ : ndarray of shape (n_features, n_components)
      The projection matrix used to transform `Y`.
  
  coef_ : ndarray of shape (n_target, n_features)
      The coefficients of the linear model such that `Y` is approximated as
      `Y = X @ coef_.T + intercept_`.
  
  intercept_ : ndarray of shape (n_targets,)
      The intercepts of the linear model such that `Y` is approximated as
      `Y = X @ coef_.T + intercept_`.
  
      .. versionadded:: 1.1
  
  n_iter_ : list of shape (n_components,)
      Number of iterations of the power method, for each
      component.
  
  n_features_in_ : int
      Number of features seen during :term:`fit`.
  
  feature_names_in_ : ndarray of shape (`n_features_in_`,)
      Names of features seen during :term:`fit`. Defined only when `X`
      has feature names that are all strings.
  
      .. versionadded:: 1.0
  
  See Also
  --------
  PLSCanonical : Partial Least Squares transformer and regressor.
  
  Examples
  --------
  >>> from sklearn.cross_decomposition import PLSRegression
  >>> X = [[0., 0., 1.], [1.,0.,0.], [2.,2.,2.], [2.,5.,4.]]
  >>> Y = [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]]
  >>> pls2 = PLSRegression(n_components=2)
  >>> pls2.fit(X, Y)
  PLSRegression()
  >>> Y_pred = pls2.predict(X)
class_docstr_tok: ["PLS","regression",".","PLSRegression","is","also","known","as","PLS2","or","PLS1",",","depending","on","the","number","of","targets",".","Read","more","in","the",":","ref",":","`","User","Guide","<","cross_decomposition",">","`",".","..","versionadded",":",":","0.8","Parameters","--","--","--","--","--","n_components",":","int",",","default=2","Number","of","components","to","keep",".","Should","be","in","`","[","1",",","min","(","n_samples",",","n_features",",","n_targets",")","]","`",".","scale",":","bool",",","default=True","Whether","to","scale","`","X","`","and","`","Y","`",".","max_iter",":","int",",","default=500","The","maximum","number","of","iterations","of","the","power","method","when","`","algorithm='nipals","'","`",".","Ignored","otherwise",".","tol",":","float",",","default=1e-06","The","tolerance","used","as","convergence","criteria","in","the","power","method",":","the","algorithm","stops","whenever","the","squared","norm","of","`","u_i","-","u_","{","i-1","}","`","is","less","than","`","tol","`",",","where","`","u","`","corresponds","to","the","left","singular","vector",".","copy",":","bool",",","default=True","Whether","to","copy","`","X","`","and","`","Y","`","in",":","term",":","`","fit","`","before","applying","centering",",","and","potentially","scaling",".","If","`","False","`",",","these","operations","will","be","done","inplace",",","modifying","both","arrays",".","Attributes","--","--","--","--","--","x_weights_",":","ndarray","of","shape","(","n_features",",","n_components",")","The","left","singular","vectors","of","the","cross-covariance","matrices","of","each","iteration",".","y_weights_",":","ndarray","of","shape","(","n_targets",",","n_components",")","The","right","singular","vectors","of","the","cross-covariance","matrices","of","each","iteration",".","x_loadings_",":","ndarray","of","shape","(","n_features",",","n_components",")","The","loadings","of","`","X","`",".","y_loadings_",":","ndarray","of","shape","(","n_targets",",","n_components",")","The","loadings","of","`","Y","`",".","x_scores_",":","ndarray","of","shape","(","n_samples",",","n_components",")","The","transformed","training","samples",".","y_scores_",":","ndarray","of","shape","(","n_samples",",","n_components",")","The","transformed","training","targets",".","x_rotations_",":","ndarray","of","shape","(","n_features",",","n_components",")","The","projection","matrix","used","to","transform","`","X","`",".","y_rotations_",":","ndarray","of","shape","(","n_features",",","n_components",")","The","projection","matrix","used","to","transform","`","Y","`",".","coef_",":","ndarray","of","shape","(","n_target",",","n_features",")","The","coefficients","of","the","linear","model","such","that","`","Y","`","is","approximated","as","`","Y","=","X","@","coef_.T","+","intercept_","`",".","intercept_",":","ndarray","of","shape","(","n_targets",",",")","The","intercepts","of","the","linear","model","such","that","`","Y","`","is","approximated","as","`","Y","=","X","@","coef_.T","+","intercept_","`",".","..","versionadded",":",":","1.1","n_iter_",":","list","of","shape","(","n_components",",",")","Number","of","iterations","of","the","power","method",",","for","each","component",".","n_features_in_",":","int","Number","of","features","seen","during",":","term",":","`","fit","`",".","feature_names_in_",":","ndarray","of","shape","(","`","n_features_in_","`",",",")","Names","of","features","seen","during",":","term",":","`","fit","`",".","Defined","only","when","`","X","`","has","feature","names","that","are","all","strings",".","..","versionadded",":",":","1.0","See","Also","--","--","--","--","PLSCanonical",":","Partial","Least","Squares","transformer","and","regressor",".","Examples","--","--","--","--",">",">",">","from","sklearn.cross_decomposition","import","PLSRegression",">",">",">","X","=","[","[","0.",",","0.",",","1",".","]",",","[","1.,0.,0",".","]",",","[","2.,2.,2",".","]",",","[","2.,5.,4",".","]","]",">",">",">","Y","=","[","[","0.1",",","-0.2","]",",","[","0.9",",","1.1","]",",","[","6.2",",","5.9","]",",","[","11.9",",","12.3","]","]",">",">",">","pls2","=","PLSRegression","(","n_components=2",")",">",">",">","pls2.fit","(","X",",","Y",")","PLSRegression","(",")",">",">",">","Y_pred","=","pls2.predict","(","X",")"]
docstr: Fit model to 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,) or (n_samples, n_targets)
      Target vectors, where `n_samples` is the number of samples and
      `n_targets` is the number of response variables.
  
  Returns
  -------
  self : object
      Fitted model.
docstr_tok: ["Fit","model","to","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",",",")","or","(","n_samples",",","n_targets",")","Target","vectors",",","where","`","n_samples","`","is","the","number","of","samples","and","`","n_targets","`","is","the","number","of","response","variables",".","Returns","--","--","--","-","self",":","object","Fitted","model","."]
code: def fit(self, X, Y):
      """Fit model to 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,) or (n_samples, n_targets)
          Target vectors, where `n_samples` is the number of samples and
          `n_targets` is the number of response variables.
  
      Returns
      -------
      self : object
          Fitted model.
      """
      super().fit(X, Y)
      # expose the fitted attributes `x_scores_` and `y_scores_`
      self.x_scores_ = self._x_scores
      self.y_scores_ = self._y_scores
      return self
  
imports: import warnings
  from abc import ABCMeta, abstractmethod
  from numbers import Integral, Real
  import numpy
  from scipy.linalg import svd
  from ..base import BaseEstimator, ClassNamePrefixFeaturesOutMixin, MultiOutputMixin, RegressorMixin, TransformerMixin, _fit_context
  from ..exceptions import ConvergenceWarning
  from ..utils import check_array, check_consistent_length
  from ..utils._param_validation import Interval, StrOptions
  from ..utils.extmath import svd_flip
  from ..utils.fixes import parse_version, sp_version
  from ..utils.validation import FLOAT_DTYPES, check_is_fitted
label_desc: Use image node_id 2 for calling the PLSRegression obj's underlying member method code with example usage: obj.fit(X, Y) and returns: self