class_docstr: Partial Least Squares (PLS)
  
  This class implements the generic PLS algorithm.
  
  Main ref: Wegelin, a survey of Partial Least Squares (PLS) methods,
  with emphasis on the two-block case
  https://stat.uw.edu/sites/default/files/files/reports/2000/tr371.pdf
class_docstr_tok: ["Partial","Least","Squares","(","PLS",")","This","class","implements","the","generic","PLS","algorithm",".","Main","ref",":","Wegelin",",","a","survey","of","Partial","Least","Squares","(","PLS",")","methods",",","with","emphasis","on","the","two-block","case","https",":","\/\/stat.uw.edu\/sites\/default\/files\/files\/reports\/2000\/tr371.pdf"]
docstr: Apply the dimension reduction.
  
  Parameters
  ----------
  X : array-like of shape (n_samples, n_features)
      Samples to transform.
  
  Y : array-like of shape (n_samples, n_targets), default=None
      Target vectors.
  
  copy : bool, default=True
      Whether to copy `X` and `Y`, or perform in-place normalization.
  
  Returns
  -------
  x_scores, y_scores : array-like or tuple of array-like
      Return `x_scores` if `Y` is not given, `(x_scores, y_scores)` otherwise.
docstr_tok: ["Apply","the","dimension","reduction",".","Parameters","--","--","--","--","--","X",":","array-like","of","shape","(","n_samples",",","n_features",")","Samples","to","transform",".","Y",":","array-like","of","shape","(","n_samples",",","n_targets",")",",","default=None","Target","vectors",".","copy",":","bool",",","default=True","Whether","to","copy","`","X","`","and","`","Y","`",",","or","perform","in-place","normalization",".","Returns","--","--","--","-","x_scores",",","y_scores",":","array-like","or","tuple","of","array-like","Return","`","x_scores","`","if","`","Y","`","is","not","given",",","`","(","x_scores",",","y_scores",")","`","otherwise","."]
code: def transform(self, X, Y=None, copy=True):
      """Apply the dimension reduction.
  
      Parameters
      ----------
      X : array-like of shape (n_samples, n_features)
          Samples to transform.
  
      Y : array-like of shape (n_samples, n_targets), default=None
          Target vectors.
  
      copy : bool, default=True
          Whether to copy `X` and `Y`, or perform in-place normalization.
  
      Returns
      -------
      x_scores, y_scores : array-like or tuple of array-like
          Return `x_scores` if `Y` is not given, `(x_scores, y_scores)` otherwise.
      """
      check_is_fitted(self)
      X = self._validate_data(
          X, copy=copy, dtype=FLOAT_DTYPES, reset=False
      )
      # Normalize
      X -= self._x_mean
      X /= self._x_std
      # Apply rotation
      x_scores = np.dot(X, self.x_rotations_)
      if Y is not None:
          Y = check_array(
              Y,
              input_name="Y",
              ensure_2d=False,
              copy=copy,
              dtype=FLOAT_DTYPES,
          )
          if Y.ndim == 1:
              Y = Y.reshape(-1, 1)
          Y -= self._y_mean
          Y /= self._y_std
          y_scores = np.dot(Y, self.y_rotations_)
          return x_scores, y_scores
  
      return x_scores
  
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 3 for calling the _PLS obj's underlying member method code with example usage: obj.transform(X, Y, copy) and returns: x_scores, x_scores,  y_scores