8000 DOC Ensures that PatchExtractor passes numpydoc validation (#21233) · scikit-learn/scikit-learn@23afd5d · GitHub
[go: up one dir, main page]

Skip to content

Commit 23afd5d

Browse files
authored
DOC Ensures that PatchExtractor passes numpydoc validation (#21233)
1 parent 6edbffd commit 23afd5d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

maint_tools/test_docstrings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"OrthogonalMatchingPursuitCV",
2323
"PassiveAggressiveClassifier",
2424
"PassiveAggressiveRegressor",
25-
"PatchExtractor",
2625
"PolynomialFeatures",
2726
"QuadraticDiscriminantAnalysis",
2827
"SelfTrainingClassifier",

sklearn/feature_extraction/image.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ def reconstruct_from_patches_2d(patches, image_size):
451451

452452

453453
class PatchExtractor(BaseEstimator):
454-
"""Extracts patches from a collection of images
454+
"""Extracts patches from a collection of images.
455455
456456
Read more in the :ref:`User Guide <image_feature_extraction>`.
457457
@@ -463,16 +463,20 @@ class PatchExtractor(BaseEstimator):
463463
The dimensions of one patch.
464464
465465
max_patches : int or float, default=None
466-
The maximum number of patches per image to extract. If max_patches is a
467-
float in (0, 1), it is taken to mean a proportion of the total number
466+
The maximum number of patches per image to extract. If `max_patches` is
467+
a float in (0, 1), it is taken to mean a proportion of the total number
468468
of patches.
469469
470470
random_state : int, RandomState instance, default=None
471471
Determines the random number generator used for random sampling when
472-
`max_patches` is not None. Use an int to make the randomness
472+
`max_patches is not None`. Use an int to make the randomness
473473
deterministic.
474474
See :term:`Glossary <random_state>`.
475475
476+
See Also
477+
--------
478+
reconstruct_from_patches_2d : Reconstruct image from all of its patches.
479+
476480
Examples
477481
--------
478482
>>> from sklearn.datasets import load_sample_images
@@ -503,11 +507,19 @@ def fit(self, X, y=None):
503507
----------
504508
X : array-like of shape (n_samples, n_features)
505509
Training data.
510+
511+
y : Ignored
512+
Not used, present for API consistency by convention.
513+
514+
Returns
515+
-------
516+
self : object
517+
Returns the instance itself.
506518
"""
507519
return self
508520

509521
def transform(self, X):
510-
"""Transforms the image samples in X into a matrix of patch data.
522+
"""Transform the image samples in `X` into a matrix of patch data.
511523
512524
Parameters
513525
----------

0 commit comments

Comments
 (0)
0