8000 Standardize Docstrings for Parameters and Attributes · Issue #14404 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

Standardize Docstrings for Parameters and Attributes #14404

@thomasjpfan

Description

@thomasjpfan

With #14375, we should finally standardize how we document the type of parameters and attributes. Once we decide on a style and make changes, we can include a test to enforce the policy.

  1. Do not use optional. Use default=. str {'a', 'b'} or float, default=1.0
  2. Python basic types. (bool instead of boolean)
  3. When defining 1-D shape, use parenthesis. array-like shape=(n_samples,), None, default=None.
  4. When defining 2-D shape, use parenthesis. array-like shape=(n_samples, n_features).
  5. str with muliple options: {'log', 'squared', 'multinomial'}
  6. If there is only one str option the {} is not needed: algorithm: 'auto'
  7. Only use or for separating types. float, int or None, default=None
  8. Only use comma to separate types. Information such as shape or string options are defined together. Here is an extreme example:
{'a', 'b'}, float, int, array-like shape=(n_samples,) or None, default=None
  1. When support array-like and sparse matrix use: {array-link, sparse matrix} shape=(n_samples, n_features)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0