From 8f34739cc157fb267bfe03b33fa1e78d11a4c77a Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 29 Sep 2021 11:40:25 -0300 Subject: [PATCH 1/3] Remove PLSSVD from DOCSTRING_IGNORE_LIST --- maint_tools/test_docstrings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/maint_tools/test_docstrings.py b/maint_tools/test_docstrings.py index 5a0c5b4150bb4..31474cdb59b74 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -23,7 +23,6 @@ "OrthogonalMatchingPursuit", "OrthogonalMatchingPursuitCV", "PLSRegression", - "PLSSVD", "PassiveAggressiveClassifier", "PassiveAggressiveRegressor", "PatchExtractor", From a698acd8cf04ad014ea8170f9458889787d2f5de Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 29 Sep 2021 11:40:48 -0300 Subject: [PATCH 2/3] Fix numpydocs from PLSSVD --- sklearn/cross_decomposition/_pls.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index 66dc4e74ab4a0..a40c11c8b64b2 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -968,6 +968,11 @@ class PLSSVD(TransformerMixin, BaseEstimator): .. versionadded:: 1.0 + See Also + -------- + PLSCanonical : Partial Least Squares transformer and regressor. + CCA : Canonical Correlation Analysis. + Examples -------- >>> import numpy as np @@ -984,11 +989,6 @@ class PLSSVD(TransformerMixin, BaseEstimator): >>> X_c, Y_c = pls.transform(X, Y) >>> X_c.shape, Y_c.shape ((4, 2), (4, 2)) - - See Also - -------- - PLSCanonical - CCA """ def __init__(self, n_components=2, *, scale=True, copy=True): @@ -1006,6 +1006,11 @@ def fit(self, X, Y): Y : array-like of shape (n_samples,) or (n_samples, n_targets) Targets. + + Returns + ------- + self : object + Fitted estimator. """ check_consistent_length(X, Y) X = self._validate_data( From aa060f4e540b1c8f47bf079908b8dfcd3b3f31d6 Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Wed, 29 Sep 2021 12:20:08 -0300 Subject: [PATCH 3/3] Change docstrings to maintain consistency --- sklearn/cross_decomposition/_pls.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index a40c11c8b64b2..77bdd2b188615 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -910,10 +910,10 @@ def __init__( class PLSSVD(TransformerMixin, BaseEstimator): """Partial Least Square SVD. - This transformer simply performs a SVD on the crosscovariance matrix X'Y. - It is able to project both the training data `X` and the targets `Y`. The - training data X is projected on the left singular vectors, while the - targets are projected on the right singular vectors. + This transformer simply performs a SVD on the cross-covariance matrix + `X'Y`. It is able to project both the training data `X` and the targets + `Y`. The training data `X` is projected on the left singular vectors, while + the targets are projected on the right singular vectors. Read more in the :ref:`User Guide `. @@ -930,18 +930,18 @@ class PLSSVD(TransformerMixin, BaseEstimator): copy : bool, default=True Whether to copy `X` and `Y` in fit before applying centering, and - potentially scaling. If False, these operations will be done inplace, + 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 SVD of the cross-covariance matrix. - Used to project `X` in `transform`. + Used to project `X` in :meth:`transform`. y_weights_ : ndarray of (n_targets, n_components) The right singular vectors of the SVD of the cross-covariance matrix. - Used to project `X` in `transform`. + Used to project `X` in :meth:`transform`. x_scores_ : ndarray of shape (n_samples, n_components) The transformed training samples. @@ -1123,7 +1123,7 @@ def transform(self, X, Y=None): Returns ------- x_scores : array-like or tuple of array-like - The transformed data `X_tranformed` if `Y` is not None, + The transformed data `X_tranformed` if `Y is not None`, `(X_transformed, Y_transformed)` otherwise. """ check_is_fitted(self) @@ -1154,7 +1154,7 @@ def fit_transform(self, X, y=None): Returns ------- out : array-like or tuple of array-like - The transformed data `X_tranformed` if `Y` is not None, + The transformed data `X_tranformed` if `Y is not None`, `(X_transformed, Y_transformed)` otherwise. """ return self.fit(X, y).transform(X, y)