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 tips for reading the code base #12874

Merged
merged 6 commits into from
Dec 31, 2018

Conversation

NicolasHug
Copy link
Member

Reference Issues/PRs

Closes #12869

What does this implement/fix? Explain your changes.

This PR adds a section in contributing.rst with tips to be more efficient at reading/understanding the code

Any other comments?

Feel free to add / change anything you deem relevant

Copy link
Contributor

@albertcthomas albertcthomas left a comment

Choose a reason for hiding this comment

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

Thanks @NicolasHug! I really like this! We should maybe add a bullet about class inheritance and say that some methods might be implemented in a parent class. And also talk about Mixins depending on the type of the estimator (classifier, regressor, clusterer or outlier detector).

on GitHub. ``git grep`` (`examples
<https://git-scm.com/docs/git-grep#_examples>`_) is also extremely
useful to see every occurrence of a pattern (e.g. a function call or a
variable) in the code base.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add that git grep only searches files tracked by git by default compared to grep. Unless scikit-learn doc is not considered to be the place to say this. It's just that I have been using grep for a while before realizing that git grep might be better for this purpose :)

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 sure? I feel it's not really necessary since it's quiet unlikely that the intended audience of this section will ever need to look for patterns in untracked files, and if they do they can still refer to the doc in the link.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay leave it as it is.

Copy link
Member

@qinhanmin2014 qinhanmin2014 left a comment

Choose a reason for hiding this comment

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

Generally LGTM, thanks @NicolasHug
Maybe this deserves a link in CONTRIBUTING.md

doc/developers/contributing.rst Outdated Show resolved Hide resolved
doc/developers/contributing.rst Show resolved Hide resolved
doc/developers/contributing.rst Outdated Show resolved Hide resolved
doc/developers/contributing.rst Outdated Show resolved Hide resolved
@adrinjalali
Copy link
Member

Awesome, thanks!

default behaviour depending on the nature of the estimator (classifier,
regressor, transformer, etc.).
- Sometimes, reading the tests for a given function will give you an idea of
what is its intended purpose. You can use ``git grep`` (see below) to find
Copy link
Member

Choose a reason for hiding this comment

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

nitpick: -> what its intended purpose is.

- Due to the use of `Inheritance
<https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)>`_,
some methods may be implemented in parent classes. All estimators inherit
at least from ``BaseEstimator``, and from a ``Mixin`` class that enables
Copy link
Member

Choose a reason for hiding this comment

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

probably useful to link to the actual classes like you do with the LinearRegression above.

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Otherwise looks pretty good to me!

@adrinjalali adrinjalali merged commit fda8f47 into scikit-learn:master Dec 31, 2018
adrinjalali pushed a commit to adrinjalali/scikit-learn that referenced this pull request Jan 7, 2019
* Added tips for reading the code base

* Put it in contributing.rst

* Added bullet point about inheritance
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Feb 19, 2019
* Added tips for reading the code base

* Put it in contributing.rst

* Added bullet point about inheritance
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
* Added tips for reading the code base

* Put it in contributing.rst

* Added bullet point about inheritance
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
xhluca pushed a commit to xhluca/scikit-learn that referenced this pull request Apr 28, 2019
koenvandevelde pushed a commit to koenvandevelde/scikit-learn that referenced this pull request Jul 12, 2019
* Added tips for reading the code base

* Put it in contributing.rst

* Added bullet point about inheritance
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.

Creation of a 'Reading scikit-learn code' section in the docs?
4 participants