From a3e6d4319c617f7cf854b79354d23f49bdec6603 Mon Sep 17 00:00:00 2001 From: Harini Sridhar Date: Sat, 2 Nov 2019 11:48:59 -0700 Subject: [PATCH 1/9] Added Sphinx versionadded to TimeSeriesSplit docstring (Issue #15426) --- sklearn/model_selection/_split.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index 8aa49884f26e3..8c9e63712597d 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -784,6 +784,8 @@ class TimeSeriesSplit(_BaseKFold): + n_samples % (n_splits + 1)`` in the ``i``th split, with a test set of size ``n_samples//(n_splits + 1)``, where ``n_samples`` is the number of samples. + + .. versionadded:: 0.18 """ def __init__(self, n_splits=5, max_train_size=None): super().__init__(n_splits, shuffle=False, random_state=None) From baccef5859f6ea461cd84a652b8c32b24094ea37 Mon Sep 17 00:00:00 2001 From: Harini Sridhar Date: Sat, 2 Nov 2019 12:52:02 -0700 Subject: [PATCH 2/9] Added Sphinx versionadded to docstrings of PLSCanonical, PLSRegression, PLSSVD, PatchExtractor, Pipeline, PowerTransformer, PredefinedSplit (Issue #15426) --- sklearn/cross_decomposition/_pls.py | 6 ++++++ sklearn/feature_extraction/image.py | 2 ++ sklearn/model_selection/_split.py | 4 ++-- sklearn/pipeline.py | 3 +++ sklearn/preprocessing/_data.py | 2 ++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index a429872020ad0..09c4b7f16f0d3 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -634,6 +634,8 @@ class PLSRegression(_PLS): In french but still a reference: Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. + + .. versionadded:: 0.8 """ def __init__(self, n_components=2, scale=True, @@ -778,6 +780,8 @@ class PLSCanonical(_PLS): -------- CCA PLSSVD + + .. versionadded:: 0.8 """ def __init__(self, n_components=2, scale=True, algorithm="nipals", @@ -845,6 +849,8 @@ class PLSSVD(TransformerMixin, BaseEstimator): -------- PLSCanonical CCA + + .. versionadded:: 0.8 """ def __init__(self, n_components=2, scale=True, copy=True): diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index 2cec6739e7f98..6ad439c0c6f00 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -513,6 +513,8 @@ class PatchExtractor(BaseEstimator): >>> pe_trans = pe.transform(X) >>> print('Patches shape: {}'.format(pe_trans.shape)) Patches shape: (545706, 2, 2) + + .. versionadded:: 0.9 """ def __init__(self, patch_size=None, max_patches=None, random_state=None): diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index 8c9e63712597d..d4954eeb2ec1f 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -784,8 +784,6 @@ class TimeSeriesSplit(_BaseKFold): + n_samples % (n_splits + 1)`` in the ``i``th split, with a test set of size ``n_samples//(n_splits + 1)``, where ``n_samples`` is the number of samples. - - .. versionadded:: 0.18 """ def __init__(self, n_splits=5, max_train_size=None): super().__init__(n_splits, shuffle=False, random_state=None) @@ -1844,6 +1842,8 @@ class PredefinedSplit(BaseCrossValidator): ... y_train, y_test = y[train_index], y[test_index] TRAIN: [1 2 3] TEST: [0] TRAIN: [0 2] TEST: [1 3] + + .. versionadded:: 0.16 """ def __init__(self, test_fold): diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index a232a8a7b61fb..14beb6c8ae9a4 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -122,6 +122,9 @@ class Pipeline(_BaseComposition): (1, 10) >>> sub_pipeline.inverse_transform(coef).shape (1, 20) + + .. versionadded:: 0.5 + """ # BaseEstimator interface diff --git a/sklearn/preprocessing/_data.py b/sklearn/preprocessing/_data.py index 72ab1f9b45a57..c2226613c09cb 100644 --- a/sklearn/preprocessing/_data.py +++ b/sklearn/preprocessing/_data.py @@ -2715,6 +2715,8 @@ class PowerTransformer(TransformerMixin, BaseEstimator): .. [2] G.E.P. Box and D.R. Cox, "An Analysis of Transformations", Journal of the Royal Statistical Society B, 26, 211-252 (1964). + + .. versionadded:: 0.19.2 """ def __init__(self, method='yeo-johnson', standardize=True, copy=True): self.method = method From 9b072d371bd8ed26150b688e98480a9db7796214 Mon Sep 17 00:00:00 2001 From: Reshama Date: Mon, 9 Dec 2019 11:19:29 -0500 Subject: [PATCH 3/9] moving 'versionadded' to before parameters section --- sklearn/cross_decomposition/_pls.py | 3 ++- sklearn/feature_extraction/image.py | 3 ++- sklearn/model_selection/_split.py | 3 ++- sklearn/pipeline.py | 4 ++-- sklearn/preprocessing/_data.py | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index 09c4b7f16f0d3..abda5f86cbd75 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -517,6 +517,8 @@ class PLSRegression(_PLS): Read more in the :ref:`User Guide `. + .. versionadded:: 0.8 + Parameters ---------- n_components : int, (default 2) @@ -635,7 +637,6 @@ class PLSRegression(_PLS): Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. - .. versionadded:: 0.8 """ def __init__(self, n_components=2, scale=True, diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index 6ad439c0c6f00..1a4539b73ce92 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -483,6 +483,8 @@ class PatchExtractor(BaseEstimator): Read more in the :ref:`User Guide `. + .. versionadded:: 0.9 + Parameters ---------- patch_size : tuple of ints (patch_height, patch_width) @@ -514,7 +516,6 @@ class PatchExtractor(BaseEstimator): >>> print('Patches shape: {}'.format(pe_trans.shape)) Patches shape: (545706, 2, 2) - .. versionadded:: 0.9 """ def __init__(self, patch_size=None, max_patches=None, random_state=None): diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index d4954eeb2ec1f..19a964d3c8e98 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -1816,6 +1816,8 @@ class PredefinedSplit(BaseCrossValidator): Read more in the :ref:`User Guide `. + .. versionadded:: 0.16 + Parameters ---------- test_fold : array-like, shape (n_samples,) @@ -1843,7 +1845,6 @@ class PredefinedSplit(BaseCrossValidator): TRAIN: [1 2 3] TEST: [0] TRAIN: [0 2] TEST: [1 3] - .. versionadded:: 0.16 """ def __init__(self, test_fold): diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index 14beb6c8ae9a4..47f99e5fd94b4 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -47,6 +47,8 @@ class Pipeline(_BaseComposition): Read more in the :ref:`User Guide `. + .. versionadded:: 0.5 + Parameters ---------- steps : list @@ -123,8 +125,6 @@ class Pipeline(_BaseComposition): >>> sub_pipeline.inverse_transform(coef).shape (1, 20) - .. versionadded:: 0.5 - """ # BaseEstimator interface diff --git a/sklearn/preprocessing/_data.py b/sklearn/preprocessing/_data.py index c2226613c09cb..2ea7553398ed4 100644 --- a/sklearn/preprocessing/_data.py +++ b/sklearn/preprocessing/_data.py @@ -2655,6 +2655,8 @@ class PowerTransformer(TransformerMixin, BaseEstimator): Read more in the :ref:`User Guide `. + .. versionadded:: 0.20 + Parameters ---------- method : str, (default='yeo-johnson') @@ -2716,7 +2718,6 @@ class PowerTransformer(TransformerMixin, BaseEstimator): .. [2] G.E.P. Box and D.R. Cox, "An Analysis of Transformations", Journal of the Royal Statistical Society B, 26, 211-252 (1964). - .. versionadded:: 0.19.2 """ def __init__(self, method='yeo-johnson', standardize=True, copy=True): self.method = method From bc0310e4096f4cd0c77206a54118ac32fb1569e5 Mon Sep 17 00:00:00 2001 From: Reshama Date: Mon, 9 Dec 2019 11:26:06 -0500 Subject: [PATCH 4/9] fixed flake8 whitespace errors --- sklearn/feature_extraction/image.py | 1 - sklearn/model_selection/_split.py | 1 - sklearn/pipeline.py | 1 - 3 files changed, 3 deletions(-) diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index 1a4539b73ce92..f0241f21440b3 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -484,7 +484,6 @@ class PatchExtractor(BaseEstimator): Read more in the :ref:`User Guide `. .. versionadded:: 0.9 - Parameters ---------- patch_size : tuple of ints (patch_height, patch_width) diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index 19a964d3c8e98..d0425b4cd69ad 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -1817,7 +1817,6 @@ class PredefinedSplit(BaseCrossValidator): Read more in the :ref:`User Guide `. .. versionadded:: 0.16 - Parameters ---------- test_fold : array-like, shape (n_samples,) diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index 47f99e5fd94b4..6a82453d26b8c 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -48,7 +48,6 @@ class Pipeline(_BaseComposition): Read more in the :ref:`User Guide `. .. versionadded:: 0.5 - Parameters ---------- steps : list From a552521c3532de4fd8fe95e35500ab29313630e0 Mon Sep 17 00:00:00 2001 From: Reshama Date: Tue, 10 Dec 2019 12:36:50 -0500 Subject: [PATCH 5/9] removed/added blank lines --- sklearn/cross_decomposition/_pls.py | 7 ++++--- sklearn/feature_extraction/image.py | 3 ++- sklearn/model_selection/_split.py | 2 +- sklearn/pipeline.py | 1 + sklearn/preprocessing/_data.py | 1 - 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index d23239674b1ae..82552dbf280cb 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -645,7 +645,6 @@ class PLSRegression(_PLS): Jacob A. Wegelin. A survey of Partial Least Squares (PLS) methods, with emphasis on the two-block case. Technical Report 371, Department of Statistics, University of Washington, Seattle, 2000. - In french but still a reference: Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. @@ -671,6 +670,8 @@ class PLSCanonical(_PLS): Read more in the :ref:`User Guide `. + .. versionadded:: 0.8 + Parameters ---------- n_components : int, (default 2). @@ -795,7 +796,6 @@ class PLSCanonical(_PLS): CCA PLSSVD - .. versionadded:: 0.8 """ def __init__(self, n_components=2, scale=True, algorithm="nipals", @@ -815,6 +815,8 @@ class PLSSVD(TransformerMixin, BaseEstimator): Read more in the :ref:`User Guide `. + .. versionadded:: 0.8 + Parameters ---------- n_components : int, default 2 @@ -864,7 +866,6 @@ class PLSSVD(TransformerMixin, BaseEstimator): PLSCanonical CCA - .. versionadded:: 0.8 """ def __init__(self, n_components=2, scale=True, copy=True): diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index f0241f21440b3..d0da784c526d7 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -298,6 +298,7 @@ def _extract_patches(arr, patch_shape=8, extraction_step=1): patches = as_strided(arr, shape=shape, strides=strides) return patches + @deprecated("The function feature_extraction.image.extract_patches has been " "deprecated in 0.22 and will be removed in 0.24.") def extract_patches(arr, patch_shape=8, extraction_step=1): @@ -484,6 +485,7 @@ class PatchExtractor(BaseEstimator): Read more in the :ref:`User Guide `. .. versionadded:: 0.9 + Parameters ---------- patch_size : tuple of ints (patch_height, patch_width) @@ -514,7 +516,6 @@ class PatchExtractor(BaseEstimator): >>> pe_trans = pe.transform(X) >>> print('Patches shape: {}'.format(pe_trans.shape)) Patches shape: (545706, 2, 2) - """ def __init__(self, patch_size=None, max_patches=None, random_state=None): diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py index a2c07cf9dc078..bb0643e8c8edb 100644 --- a/sklearn/model_selection/_split.py +++ b/sklearn/model_selection/_split.py @@ -1817,6 +1817,7 @@ class PredefinedSplit(BaseCrossValidator): Read more in the :ref:`User Guide `. .. versionadded:: 0.16 + Parameters ---------- test_fold : array-like, shape (n_samples,) @@ -1843,7 +1844,6 @@ class PredefinedSplit(BaseCrossValidator): ... y_train, y_test = y[train_index], y[test_index] TRAIN: [1 2 3] TEST: [0] TRAIN: [0 2] TEST: [1 3] - """ def __init__(self, test_fold): diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index f5256053df24a..48e1c44670731 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -48,6 +48,7 @@ class Pipeline(_BaseComposition): Read more in the :ref:`User Guide `. .. versionadded:: 0.5 + Parameters ---------- steps : list diff --git a/sklearn/preprocessing/_data.py b/sklearn/preprocessing/_data.py index c2fd748d47707..51c714eb3baca 100644 --- a/sklearn/preprocessing/_data.py +++ b/sklearn/preprocessing/_data.py @@ -2741,7 +2741,6 @@ class PowerTransformer(TransformerMixin, BaseEstimator): .. [2] G.E.P. Box and D.R. Cox, "An Analysis of Transformations", Journal of the Royal Statistical Society B, 26, 211-252 (1964). - """ def __init__(self, method='yeo-johnson', standardize=True, copy=True): self.method = method From 7367fa8fbbfc18c579954c7f8922dc7c87ff1303 Mon Sep 17 00:00:00 2001 From: Reshama Date: Tue, 10 Dec 2019 15:42:24 -0500 Subject: [PATCH 6/9] adding/removing lines --- sklearn/cross_decomposition/_pls.py | 2 -- sklearn/pipeline.py | 1 - 2 files changed, 3 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index 82552dbf280cb..f421fecd99c0a 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -234,11 +234,9 @@ class _PLS(TransformerMixin, RegressorMixin, MultiOutputMixin, BaseEstimator, Jacob A. Wegelin. A survey of Partial Least Squares (PLS) methods, with emphasis on the two-block case. Technical Report 371, Department of Statistics, University of Washington, Seattle, 2000. - In French but still a reference: Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. - See also -------- PLSCanonical diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index 48e1c44670731..453ce2228d50d 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -124,7 +124,6 @@ class Pipeline(_BaseComposition): (1, 10) >>> sub_pipeline.inverse_transform(coef).shape (1, 20) - """ # BaseEstimator interface From 407b49fa6e838c97d07ca1c10f5f85134c36d0da Mon Sep 17 00:00:00 2001 From: Reshama Date: Mon, 16 Dec 2019 08:52:28 -0500 Subject: [PATCH 7/9] ?chg to _pls.py --- sklearn/cross_decomposition/_pls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index f421fecd99c0a..e6fd3f6203d78 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -234,9 +234,11 @@ class _PLS(TransformerMixin, RegressorMixin, MultiOutputMixin, BaseEstimator, Jacob A. Wegelin. A survey of Partial Least Squares (PLS) methods, with emphasis on the two-block case. Technical Report 371, Department of Statistics, University of Washington, Seattle, 2000. + In French but still a reference: Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. + See also -------- PLSCanonical @@ -643,10 +645,10 @@ class PLSRegression(_PLS): Jacob A. Wegelin. A survey of Partial Least Squares (PLS) methods, with emphasis on the two-block case. Technical Report 371, Department of Statistics, University of Washington, Seattle, 2000. + In french but still a reference: Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. - """ def __init__(self, n_components=2, scale=True, @@ -788,12 +790,10 @@ class PLSCanonical(_PLS): Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. - See also -------- CCA PLSSVD - """ def __init__(self, n_components=2, scale=True, algorithm="nipals", From 2af47304e2a8dc891e625649782aa1ba0853cf5c Mon Sep 17 00:00:00 2001 From: Reshama Date: Mon, 16 Dec 2019 08:57:56 -0500 Subject: [PATCH 8/9] added blank line --- sklearn/cross_decomposition/_pls.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index e6fd3f6203d78..8cae9212f8bab 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -790,6 +790,7 @@ class PLSCanonical(_PLS): Tenenhaus, M. (1998). La regression PLS: theorie et pratique. Paris: Editions Technic. + See also -------- CCA From 200d78e7291624bf81e93e70cfe6c9c6ae77126b Mon Sep 17 00:00:00 2001 From: Reshama Date: Mon, 16 Dec 2019 09:03:23 -0500 Subject: [PATCH 9/9] remembered to save/commit changes this time --- sklearn/cross_decomposition/_pls.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sklearn/cross_decomposition/_pls.py b/sklearn/cross_decomposition/_pls.py index 8cae9212f8bab..125c5946b1562 100644 --- a/sklearn/cross_decomposition/_pls.py +++ b/sklearn/cross_decomposition/_pls.py @@ -864,7 +864,6 @@ class PLSSVD(TransformerMixin, BaseEstimator): -------- PLSCanonical CCA - """ def __init__(self, n_components=2, scale=True, copy=True):