Skip to content
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

[MRG] Deterministic order for load_sample_images #13250

Merged
merged 13 commits into from Feb 26, 2019
@@ -225,6 +225,9 @@ Changelog
- |Fix| :func:`datasets.fetch_openml` to retry downloading when reading
from local cache fails. :issue:`12517` by :user:`Thomas Fan <thomasjpfan>`.

- |Fix| :func:`datasets.load_sample_images` returns images with a deterministic

This comment has been minimized.

Copy link
@qinhanmin2014

qinhanmin2014 Feb 25, 2019

Member

Seems that Joel labelled the issues as 0.20.3, so I think it's acceptable.

This comment has been minimized.

Copy link
@jnothman

jnothman Feb 25, 2019

Member

I think I labelled it as 0.20.3 by mistake. The doctest isn't in 0.20. I'd rather this fix in 0.21

order. :issue:`13250` by :user:`Thomas Fan <thomasjpfan>`.

:mod:`sklearn.decomposition`
............................

@@ -794,7 +794,7 @@ def load_sample_images():
with open(join(module_path, 'README.txt')) as f:
descr = f.read()
filenames = [join(module_path, filename)
for filename in os.listdir(module_path)
for filename in sorted(os.listdir(module_path))
if filename.endswith(".jpg")]
# Load image data for each image in the source folder.
images = [imread(filename) for filename in filenames]
@@ -347,6 +347,17 @@ def extract_patches_2d(image, patch_size, max_patches=None, random_state=None):
>>> patches = image.extract_patches_2d(one_image, (2, 2))
>>> print('Patches shape: {}'.format(patches.shape))
Patches shape: (272214, 2, 2, 3)
>>> # Here are just two of these patches:
>>> print(patches[1]) # doctest: +NORMALIZE_WHITESPACE
[[[174 201 231]
[174 201 231]]
[[173 200 230]
[173 200 230]]]
>>> print(patches[800])# doctest: +NORMALIZE_WHITESPACE
[[[187 214 243]
[188 215 244]]
[[187 214 243]
[188 215 244]]]
"""
i_h, i_w = image.shape[:2]
p_h, p_w = patch_size
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.