Skip to content

MAINT Parameters validation for reconstruct_from_patches_2d #25384

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 5 commits into from
Feb 7, 2023
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
3 changes: 2 additions & 1 deletion sklearn/feature_extraction/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from numpy.lib.stride_tricks import as_strided

from ..utils import check_array, check_random_state
from ..utils._param_validation import Interval, validate_params
from ..utils._param_validation import Hidden, Interval, validate_params
from ..base import BaseEstimator

__all__ = [
Expand Down Expand Up @@ -447,6 +447,7 @@ def extract_patches_2d(image, patch_size, *, max_patches=None, random_state=None
return patches


@validate_params({"patches": [np.ndarray], "image_size": [tuple, Hidden(list)]})
def reconstruct_from_patches_2d(patches, image_size):
"""Reconstruct the image from all of its patches.

Expand Down
1 change: 1 addition & 0 deletions sklearn/tests/test_public_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def _check_function_param_validation(
"sklearn.feature_extraction.grid_to_graph",
"sklearn.feature_extraction.img_to_graph",
"sklearn.feature_extraction.image.extract_patches_2d",
"sklearn.feature_extraction.image.reconstruct_from_patches_2d",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.auc",
"sklearn.metrics.average_precision_score",
Expand Down