Skip to content

[MRG + 1 (rv) + 1 (alex) + 1] Add a check to test the docstring params and their order #9206

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 77 commits into from
Jul 11, 2017

Conversation

raghavrv
Copy link
Member

@raghavrv raghavrv commented Jun 23, 2017

Taking over Alex's #9023

Fixes #7758

Also refer alternative implementation at #7793

What does this implement/fix? Explain your changes.

This adds a unit test to check that all parameters are documented and in the right order.

cc: @agramfort @neerajgangwar

@raghavrv
Copy link
Member Author

raghavrv commented Jun 23, 2017

These need fixing - EDIT: Fixed

E           sklearn.covariance.outlier_detection.__init__ arg mismatch: ['random_state'] (EllipticEnvelope)
E           sklearn.decomposition.fastica_.transform copy != y (FastICA)
E           sklearn.decomposition.fastica_.transform y != copy (FastICA)
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params']
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params'] (ElasticNet)
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params'] (ElasticNetCV)
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params'] (Lasso)
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params'] (MultiTaskElasticNet)
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params'] (MultiTaskElasticNetCV)
E           sklearn.linear_model.coordinate_descent.enet_path arg mismatch: ['params'] (MultiTaskLasso)
E           sklearn.linear_model.coordinate_descent.lasso_path arg mismatch: ['params']
E           sklearn.linear_model.coordinate_descent.lasso_path arg mismatch: ['params'] (LassoCV)
E           sklearn.linear_model.coordinate_descent.lasso_path arg mismatch: ['params'] (MultiTaskLassoCV)
E           sklearn.preprocessing.data.inverse_transform arg mismatch: ['X'] (QuantileTransformer)
E           sklearn.preprocessing.data.transform arg mismatch: ['copy'] (Binarizer)
E           sklearn.preprocessing.data.transform arg mismatch: ['copy'] (Normalizer)
E           sklearn.preprocessing.data.transform arg mismatch: ['copy'] (StandardScaler)

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.

The thing that's missing here (but can be in a future PR) is advice to developers (for the main project and for contrib). In general, we have some updates to issue contrib (including changing dependency versions).

Otherwise, LGTM on the basis of a fairly superficial review.

@jnothman jnothman changed the title [MRG + 1 (rv) + 1 (alex)] Add a check to test the docstring params and their order [MRG + 1 (rv) + 1 (alex) + 1] Add a check to test the docstring params and their order Jul 9, 2017
@jnothman
Copy link
Member

jnothman commented Jul 9, 2017

flake8

./sklearn/tests/test_docstring_parameters.py:19:1: F401 'sklearn.utils.testing._get_func_name' imported but unused
from sklearn.utils.testing import _get_func_name
^
./sklearn/tests/test_docstring_parameters.py:127:21: F821 undefined name 'get_func_name'
            name_ = get_func_name(func)
                    ^
./sklearn/utils/testing.py:852:17: F821 undefined name 'get_func_name'
    func_name = get_func_name(func, class_name=class_name)
                ^

@jnothman
Copy link
Member

jnothman commented Jul 9, 2017

Does that flake mean something isn't being run??

@@ -312,6 +312,9 @@ def linkage_tree(X, connectivity=None, n_components=None,
be symmetric and only the upper triangular half is used.
Default is None, i.e, the Ward algorithm is unstructured.

n_components : int (optional)
Copy link
Member

Choose a reason for hiding this comment

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

This parameter is unused. See #9307

Copy link
Member Author

Choose a reason for hiding this comment

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

(You don't want this addressed in this PR right?)

@raghavrv
Copy link
Member Author

Let's merge this if you are happy? @jnothman @agramfort

@agramfort
Copy link
Member

any idea why appveyor is not happy?

@raghavrv
Copy link
Member Author

That seems to be because of #9317. should be fixed after that is merged and I update master. Or you can do it separately too. It should not break anything.

@agramfort
Copy link
Member

agramfort commented Jul 10, 2017 via email

@raghavrv
Copy link
Member Author

I think it's safe to merge without waiting for appveyor @agramfort (more delay leads to merge conflicts. especially after sprints)

@agramfort
Copy link
Member

all green !

thx @raghavrv

@agramfort agramfort merged commit b6f8865 into scikit-learn:master Jul 11, 2017
@raghavrv raghavrv deleted the test_docstring branch July 11, 2017 16:51
@jnothman
Copy link
Member

jnothman commented Jul 11, 2017 via email

massich pushed a commit to massich/scikit-learn that referenced this pull request Jul 13, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
yarikoptic added a commit to yarikoptic/scikit-learn that referenced this pull request Jul 27, 2017
Release 0.19b2

* tag '0.19b2': (808 commits)
  Preparing 0.19b2
  [MRG+1] FIX out of bounds array access in SAGA (scikit-learn#9376)
  FIX make test_importances pass on 32 bit linux
  Release 0.19b1
  DOC remove 'in dev' header in whats_new.rst
  DOC typos in whats_news.rst [ci skip]
  [MRG] DOC cleaning up what's new for 0.19 (scikit-learn#9252)
  FIX t-SNE memory usage and many other optimizer issues (scikit-learn#9032)
  FIX broken link in gallery and bad title rendering
  [MRG] DOC Replace \acute by prime (scikit-learn#9332)
  Fix typos (scikit-learn#9320)
  [MRG + 1 (rv) + 1 (alex) + 1] Add a check to test the docstring params and their order (scikit-learn#9206)
  DOC Residual sum vs. regression sum (scikit-learn#9314)
  [MRG] [HOTFIX] Fix capitalization in test and hence fix failing travis at master (scikit-learn#9317)
  More informative error message for classification metrics given regression output (scikit-learn#9275)
  [MRG] COSMIT Remove unused parameters in private functions (scikit-learn#9310)
  [MRG+1] Ridgecv normalize (scikit-learn#9302)
  [MRG + 2] ENH Allow `cross_val_score`, `GridSearchCV` et al. to evaluate on multiple metrics (scikit-learn#7388)
  Add data_home parameter to fetch_kddcup99 (scikit-learn#9289)
  FIX makedirs(..., exists_ok) not available in Python 2 (scikit-learn#9284)
  ...
yarikoptic added a commit to yarikoptic/scikit-learn that referenced this pull request Jul 27, 2017
* releases: (808 commits)
  Preparing 0.19b2
  [MRG+1] FIX out of bounds array access in SAGA (scikit-learn#9376)
  FIX make test_importances pass on 32 bit linux
  Release 0.19b1
  DOC remove 'in dev' header in whats_new.rst
  DOC typos in whats_news.rst [ci skip]
  [MRG] DOC cleaning up what's new for 0.19 (scikit-learn#9252)
  FIX t-SNE memory usage and many other optimizer issues (scikit-learn#9032)
  FIX broken link in gallery and bad title rendering
  [MRG] DOC Replace \acute by prime (scikit-learn#9332)
  Fix typos (scikit-learn#9320)
  [MRG + 1 (rv) + 1 (alex) + 1] Add a check to test the docstring params and their order (scikit-learn#9206)
  DOC Residual sum vs. regression sum (scikit-learn#9314)
  [MRG] [HOTFIX] Fix capitalization in test and hence fix failing travis at master (scikit-learn#9317)
  More informative error message for classification metrics given regression output (scikit-learn#9275)
  [MRG] COSMIT Remove unused parameters in private functions (scikit-learn#9310)
  [MRG+1] Ridgecv normalize (scikit-learn#9302)
  [MRG + 2] ENH Allow `cross_val_score`, `GridSearchCV` et al. to evaluate on multiple metrics (scikit-learn#7388)
  Add data_home parameter to fetch_kddcup99 (scikit-learn#9289)
  FIX makedirs(..., exists_ok) not available in Python 2 (scikit-learn#9284)
  ...
yarikoptic added a commit to yarikoptic/scikit-learn that referenced this pull request Jul 27, 2017
* dfsg: (808 commits)
  Preparing 0.19b2
  [MRG+1] FIX out of bounds array access in SAGA (scikit-learn#9376)
  FIX make test_importances pass on 32 bit linux
  Release 0.19b1
  DOC remove 'in dev' header in whats_new.rst
  DOC typos in whats_news.rst [ci skip]
  [MRG] DOC cleaning up what's new for 0.19 (scikit-learn#9252)
  FIX t-SNE memory usage and many other optimizer issues (scikit-learn#9032)
  FIX broken link in gallery and bad title rendering
  [MRG] DOC Replace \acute by prime (scikit-learn#9332)
  Fix typos (scikit-learn#9320)
  [MRG + 1 (rv) + 1 (alex) + 1] Add a check to test the docstring params and their order (scikit-learn#9206)
  DOC Residual sum vs. regression sum (scikit-learn#9314)
  [MRG] [HOTFIX] Fix capitalization in test and hence fix failing travis at master (scikit-learn#9317)
  More informative error message for classification metrics given regression output (scikit-learn#9275)
  [MRG] COSMIT Remove unused parameters in private functions (scikit-learn#9310)
  [MRG+1] Ridgecv normalize (scikit-learn#9302)
  [MRG + 2] ENH Allow `cross_val_score`, `GridSearchCV` et al. to evaluate on multiple metrics (scikit-learn#7388)
  Add data_home parameter to fetch_kddcup99 (scikit-learn#9289)
  FIX makedirs(..., exists_ok) not available in Python 2 (scikit-learn#9284)
  ...
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
dmohns pushed a commit to dmohns/scikit-learn that referenced this pull request Aug 7, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
NelleV pushed a commit to NelleV/scikit-learn that referenced this pull request Aug 11, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
paulha pushed a commit to paulha/scikit-learn that referenced this pull request Aug 19, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
AishwaryaRK pushed a commit to AishwaryaRK/scikit-learn that referenced this pull request Aug 29, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
maskani-moh pushed a commit to maskani-moh/scikit-learn that referenced this pull request Nov 15, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
jwjohnson314 pushed a commit to jwjohnson314/scikit-learn that referenced this pull request Dec 18, 2017
…s and their order (scikit-learn#9206)

* add automatic test of docstrings for function / method signatures using numpydoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add check that all parameters are properly documented
5 participants