Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion maint_tools/test_docstrings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"OrthogonalMatchingPursuitCV",
"PassiveAggressiveClassifier",
"PassiveAggressiveRegressor",
"PatchExtractor",
"PolynomialFeatures",
"QuadraticDiscriminantAnalysis",
"SelfTrainingClassifier",
Expand Down
22 changes: 17 additions & 5 deletions sklearn/feature_extraction/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <image_feature_extraction>`.

Expand All @@ -463,16 +463,20 @@ 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 <random_state>`.

See Also
--------
reconstruct_from_patches_2d : Reconstruct image from all of its patches.

Examples
--------
>>> from sklearn.datasets import load_sample_images
Expand Down Expand Up @@ -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
----------
Expand Down