@@ -726,6 +726,19 @@ We are glad to accept any sort of documentation:
726
726
727
727
.. dropdown :: Guidelines for writing docstrings
728
728
729
+ * You can use `pytest ` to test docstrings, e.g. assuming the
730
+ `RandomForestClassifier ` docstring has been modified, the following command
731
+ would test its docstring compliance:
732
+
733
+ .. prompt :: bash
734
+
735
+ pytest --doctest-modules sklearn/ensemble/_forest.py -k RandomForestClassifier
736
+
737
+ * The correct order of sections is: Parameters, Returns, See Also, Notes, Examples.
738
+ See the `numpydoc documentation
739
+ <https://numpydoc.readthedocs.io/en/latest/format.html#sections> `_ for
740
+ information on other possible sections.
741
+
729
742
* When documenting the parameters and attributes, here is a list of some
730
743
well-formatted examples
731
744
@@ -791,7 +804,15 @@ We are glad to accept any sort of documentation:
791
804
SelectKBest : Select features based on the k highest scores.
792
805
SelectFpr : Select features based on a false positive rate test.
793
806
794
- * Add one or two snippets of code in "Example" section to show how it can be used.
807
+ * The "Notes" section is optional. It is meant to provide information on
808
+ specific behavior of a function/class/classmethod/method.
809
+
810
+ * A `Note ` can also be added to an attribute, but in that case it requires
811
+ using the `.. rubric:: Note ` directive.
812
+
813
+ * Add one or two **snippets ** of code in "Example" section to show how it can
814
+ be used. The code should be runable as is, i.e. it should include all
815
+ required imports. Keep this section as brief as possible.
795
816
796
817
797
818
.. dropdown :: Guidelines for writing the user guide and other reStructuredText documents
0 commit comments