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] Added an example to the sklearn.feature_extraction.image.PatchExtractor #12202

Closed
wants to merge 5 commits into from

Conversation

parul-l
Copy link

@parul-l parul-l commented Sep 29, 2018

…or class

Reference Issues/PRs

What does this implement/fix? Explain your changes.

I added an example to the sklearn.feature_extraction.image.PatchExtractor (#3846)

Any other comments?

--------

>>> from sklearn.feature_extraction.image import PatchExtractor
>>> X = np.random.randint(10, size=(2, 2, 2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use a built-in image instead of random data?

>>> X
array([[[5, 0],
[9, 6]],

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need these new lines.

You can have your example in a file (e.g. example.py) and pass it to a script like this one with python run_script.py < example.py and copy/paste the results to the docstring.

>>> pe = PatchExtractor(patch_size=(1024, 2), random_state=1234)
>>> pe.fit(X)
>>> X_transform = pe.transform(X)
>>> X_transform[0]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just show the shape of X_transform? And maybe use a different patch size? this seems strange.

@amueller
Copy link
Member

amueller commented Oct 1, 2018

tests are failing. Fit returns self, so you have to add that output. Also there's a pep8 error.

Copy link
Member

@jnothman jnothman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doctest is still failing. you might benefit from the NORMALIZE_WHITESPACE flag, but I've not looked into the error.

CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Dec 18, 2018
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Dec 18, 2018
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Dec 18, 2018
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Dec 18, 2018
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Dec 18, 2018
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Dec 18, 2018
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 5, 2019
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 5, 2019
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 9, 2019
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 16, 2019
…addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE +ELLIPSIS for print statements.
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 16, 2019
…addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE for print statements.
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 25, 2019
CatChenal added a commit to CatChenal/scikit-learn that referenced this pull request Jan 30, 2019
@adrinjalali
Copy link
Member

#12819 fixed this.

adrinjalali pushed a commit that referenced this pull request Jan 31, 2019
* Finalizes fix for #12202 from abandonned PR by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Extends 12202 fix over feature_extraction/image.py

* Closes #12202; white space removal

* Closes #12202; white space removal2

* Closes #12202; 3.5 compliance; added >>> in docstring code.

* Closes #12202; indentation discrep.

* Closes #12202; indentation discrep.2

* Example output formating; @jnotham

* Example output formating; forgot flake8

* Closes #12202; Removed excessive indentation in docstring (#wimlds)

* Closes #12202; Fixed inconsistent indentation in docstring (#wimlds)

* Closes #12202 (#wimlds); intentation, v3.5 compliance

* Closes #12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE +ELLIPSIS for print statements.

* Closes #12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE for print statements.

* Closes #12202 (#wimlds); Testing doctest direc.: removed DONT_ACCEPT_BLANKLINE (@jnothmam, @reshamas)

* Closes #12202 (#wimlds); Removed blank lines in doctest example.
thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Feb 6, 2019
* Finalizes fix for scikit-learn#12202 from abandonned PR by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Extends 12202 fix over feature_extraction/image.py

* Closes scikit-learn#12202; white space removal

* Closes scikit-learn#12202; white space removal2

* Closes scikit-learn#12202; 3.5 compliance; added >>> in docstring code.

* Closes scikit-learn#12202; indentation discrep.

* Closes scikit-learn#12202; indentation discrep.2

* Example output formating; @jnotham

* Example output formating; forgot flake8

* Closes scikit-learn#12202; Removed excessive indentation in docstring (#wimlds)

* Closes scikit-learn#12202; Fixed inconsistent indentation in docstring (#wimlds)

* Closes scikit-learn#12202 (#wimlds); intentation, v3.5 compliance

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE +ELLIPSIS for print statements.

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE for print statements.

* Closes scikit-learn#12202 (#wimlds); Testing doctest direc.: removed DONT_ACCEPT_BLANKLINE (@jnothmam, @reshamas)

* Closes scikit-learn#12202 (#wimlds); Removed blank lines in doctest example.
thomasjpfan pushed a commit to thomasjpfan/scikit-learn that referenced this pull request Feb 7, 2019
* Finalizes fix for scikit-learn#12202 from abandonned PR by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Extends 12202 fix over feature_extraction/image.py

* Closes scikit-learn#12202; white space removal

* Closes scikit-learn#12202; white space removal2

* Closes scikit-learn#12202; 3.5 compliance; added >>> in docstring code.

* Closes scikit-learn#12202; indentation discrep.

* Closes scikit-learn#12202; indentation discrep.2

* Example output formating; @jnotham

* Example output formating; forgot flake8

* Closes scikit-learn#12202; Removed excessive indentation in docstring (#wimlds)

* Closes scikit-learn#12202; Fixed inconsistent indentation in docstring (#wimlds)

* Closes scikit-learn#12202 (#wimlds); intentation, v3.5 compliance

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE +ELLIPSIS for print statements.

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE for print statements.

* Closes scikit-learn#12202 (#wimlds); Testing doctest direc.: removed DONT_ACCEPT_BLANKLINE (@jnothmam, @reshamas)

* Closes scikit-learn#12202 (#wimlds); Removed blank lines in doctest example.
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
* Finalizes fix for scikit-learn#12202 from abandonned PR by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Extends 12202 fix over feature_extraction/image.py

* Closes scikit-learn#12202; white space removal

* Closes scikit-learn#12202; white space removal2

* Closes scikit-learn#12202; 3.5 compliance; added >>> in docstring code.

* Closes scikit-learn#12202; indentation discrep.

* Closes scikit-learn#12202; indentation discrep.2

* Example output formating; @jnotham

* Example output formating; forgot flake8

* Closes scikit-learn#12202; Removed excessive indentation in docstring (#wimlds)

* Closes scikit-learn#12202; Fixed inconsistent indentation in docstring (#wimlds)

* Closes scikit-learn#12202 (#wimlds); intentation, v3.5 compliance

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE +ELLIPSIS for print statements.

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE for print statements.

* Closes scikit-learn#12202 (#wimlds); Testing doctest direc.: removed DONT_ACCEPT_BLANKLINE (@jnothmam, @reshamas)

* Closes scikit-learn#12202 (#wimlds); Removed blank lines in doctest example.
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
* Finalizes fix for scikit-learn#12202 from abandonned PR by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Completes 12202 fix abandoned by @parul-l

* Extends 12202 fix over feature_extraction/image.py

* Closes scikit-learn#12202; white space removal

* Closes scikit-learn#12202; white space removal2

* Closes scikit-learn#12202; 3.5 compliance; added >>> in docstring code.

* Closes scikit-learn#12202; indentation discrep.

* Closes scikit-learn#12202; indentation discrep.2

* Example output formating; @jnotham

* Example output formating; forgot flake8

* Closes scikit-learn#12202; Removed excessive indentation in docstring (#wimlds)

* Closes scikit-learn#12202; Fixed inconsistent indentation in docstring (#wimlds)

* Closes scikit-learn#12202 (#wimlds); intentation, v3.5 compliance

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE +ELLIPSIS for print statements.

* Closes scikit-learn#12202 (#wimlds); Output format issue solved with addition of # doctest: +NORMALIZE_WHITESPACE +DONT_ACCEPT_BLANKLINE for print statements.

* Closes scikit-learn#12202 (#wimlds); Testing doctest direc.: removed DONT_ACCEPT_BLANKLINE (@jnothmam, @reshamas)

* Closes scikit-learn#12202 (#wimlds); Removed blank lines in doctest example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants