Skip to content

DOC Added the meanings of default=None for PatchExtractor parameters #26005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 29, 2023
Merged
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
10 changes: 6 additions & 4 deletions sklearn/feature_extraction/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,12 +503,14 @@ class PatchExtractor(TransformerMixin, BaseEstimator):
Parameters
----------
patch_size : tuple of int (patch_height, patch_width), default=None
The dimensions of one patch.
The dimensions of one patch. If set to None, the patch size will be
automatically set to `(img_height // 10, img_width // 10)`, where
`img_height` and `img_width` are the dimensions of the input images.

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
of patches.
of patches. If set to None, extract all possible patches.

random_state : int, RandomState instance, default=None
Determines the random number generator used for random sampling when
Expand Down Expand Up @@ -614,8 +616,8 @@ def transform(self, X):
else:
if len(self.patch_size) != 2:
raise ValueError(
f"patch_size must be a tuple of two integers. Got {self.patch_size}"
" instead."
"patch_size must be a tuple of two integers. Got"
f" {self.patch_size} instead."
)
patch_size = self.patch_size

Expand Down