From 37b9dbd0e5d5befe11f1190db2bf644dc2349e07 Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Sun, 3 Oct 2021 23:34:02 -0300 Subject: [PATCH 1/3] Remove PatchExtractor 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 d4c30f327e73e..92cdfbd717406 100644 --- a/maint_tools/test_docstrings.py +++ b/maint_tools/test_docstrings.py @@ -22,7 +22,6 @@ "OrthogonalMatchingPursuitCV", "PassiveAggressiveClassifier", "PassiveAggressiveRegressor", - "PatchExtractor", "PolynomialFeatures", "QuadraticDiscriminantAnalysis", "SelfTrainingClassifier", From 93b0d83267e370c1e036b19105485edda76d5748 Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Sun, 3 Oct 2021 23:34:22 -0300 Subject: [PATCH 2/3] Fix numpydocs from PatchExtractor --- sklearn/feature_extraction/image.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index 7d71a2b5f2e32..40e048b82b9ac 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -451,7 +451,7 @@ def reconstruct_from_patches_2d(patches, image_size): class PatchExtractor(BaseEstimator): - """Extracts patches from a collection of images + """Extracts patches from a collection of images. Read more in the :ref:`User Guide `. @@ -473,6 +473,10 @@ class PatchExtractor(BaseEstimator): deterministic. See :term:`Glossary `. + See Also + -------- + reconstruct_from_patches_2d : Reconstruct image from all of its patches. + Examples -------- >>> from sklearn.datasets import load_sample_images @@ -503,11 +507,19 @@ def fit(self, X, y=None): ---------- X : array-like of shape (n_samples, n_features) Training data. + + y : Ignored + Not used, present for API consistency by convention. + + Returns + ------- + self : object + Returns the instance itself. """ return self def transform(self, X): - """Transforms the image samples in X into a matrix of patch data. + """Transform the image samples in X into a matrix of patch data. Parameters ---------- From 8e67c5ec4e49999311d166bf7cf300f906ab820e Mon Sep 17 00:00:00 2001 From: Juan Martin Loyola Date: Sun, 3 Oct 2021 23:39:47 -0300 Subject: [PATCH 3/3] Change docstrings to maintain consistency --- sklearn/feature_extraction/image.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sklearn/feature_extraction/image.py b/sklearn/feature_extraction/image.py index 40e048b82b9ac..b6fb19ff09d27 100644 --- a/sklearn/feature_extraction/image.py +++ b/sklearn/feature_extraction/image.py @@ -463,13 +463,13 @@ class PatchExtractor(BaseEstimator): The dimensions of one patch. max_patches : int or float, default=None - The maximum number of patches per image to extract. If max_patches is a - float in (0, 1), it is taken to mean a proportion of the total number + The maximum number of patches per image to extract. If `max_patches` is + a float in (0, 1), it is taken to mean a proportion of the total number of patches. random_state : int, RandomState instance, default=None Determines the random number generator used for random sampling when - `max_patches` is not None. Use an int to make the randomness + `max_patches is not None`. Use an int to make the randomness deterministic. See :term:`Glossary `. @@ -519,7 +519,7 @@ def fit(self, X, y=None): return self def transform(self, X): - """Transform the image samples in X into a matrix of patch data. + """Transform the image samples in `X` into a matrix of patch data. Parameters ----------