-
-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Description
It would be useful to enforce docstrings style with numpydoc. Currently only a small fraction of docstring pass that validation.
To improve docstring see steps below,
-
Install scikit-learn from sources (see contribution guide).
-
install numpydoc master with,
pip install https://github.com/numpy/numpydoc/archive/master.zip -
Run the docstring validation on all docstrings,
pytest maint_tools/test_docstrings.py -vand choose an estimator with an XFAIL status (meaning that it is a known failure). Write down all of its methods.
-
Run,
python maint_tools/test_docstrings.py import_pathto see the list of validation errors for a particular method, where
import_pathcan be for instancesklearn.linear_model.LogisticRegression(for the main estimator docstring) orsklearn.linear_model.LogisticRegression.fit(for the docstring of the fit method). -
Fix the docstring until validation passes. Repeat on all public methods of the chosen estimator.
-
Add the estimator to the whitelist in
maint_tools/test_docstrings.pyhere. Note that this list accepts regular expressions, soLogisticRegressionwill match all methods of that estimator, and also potentially other estimators e.g.LogisticRegressionCV. For instance one can useLogisticRegression$to only match the main estimator docstring. When running from step 2, checks for the modified estimators should then pass.
Please write in a comment of this issue, the estimator you are planning to work on. Note that some methods are shared between estimators and are located in other files e.g. estimator.set_params.