Skip to content

DOC add missing attributes to LocalOutlierFactor#17696

Merged
glemaitre merged 11 commits intoscikit-learn:masterfrom
j2heng:branch_missing_attr_1
Jun 26, 2020
Merged

DOC add missing attributes to LocalOutlierFactor#17696
glemaitre merged 11 commits intoscikit-learn:masterfrom
j2heng:branch_missing_attr_1

Conversation

@j2heng
Copy link
Copy Markdown
Contributor

@j2heng j2heng commented Jun 24, 2020

Reference Issues/PRs

References #14312

What does this implement/fix? Explain your changes.

Added effective_metric_ , effective_metric_params_ and n_samples_fit_ to docstring in LocalOutlierFactor.
LocalOutlierFactor removed from the list IGNORED in test_docstring_parameters.py.

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jun 24, 2020

To fix the linting issues:
the build log shows that you have flake8 errors (one trailing white space, and missing whitespace before a comma):

sklearn/tests/test_docstring_parameters.py:237:21: E231 missing whitespace after ','
               'MDS','MiniBatchKMeans', 
                    ^
sklearn/tests/test_docstring_parameters.py:237:40: W291 trailing whitespace
               'MDS','MiniBatchKMeans', 
                                       ^

I advise you to invest some time to configure on-the-fly flake8 checks inside your editor of choice. This allows you to spot these kind of problems while editing. There may be some materials about this in the Developer doc (not sure).

Copy link
Copy Markdown
Member

@lesteve lesteve left a comment

Choose a reason for hiding this comment

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

Some comments (not 100% sure about them) ...


effective_metric_ : str
The effective metric used for the distance computation.
If `metric` is 'minkowski', `effective_metric_` is equivalent to
Copy link
Copy Markdown
Member

@lesteve lesteve Jun 24, 2020

Choose a reason for hiding this comment

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

I am not sure you want all these details. It is quite hard to keep in sync when the code changes. Maybe this is enough (not really sure)?

Effective metric used for the distance computation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with Loic. The details should be given in the Parameters. Once it has been fitted, we just want to know that this the metric used.


effective_metric_params_ : dict
The effective additional keyword arguments for the metric function.
This is equivalent to `metric_params` in parameters if metric_params
Copy link
Copy Markdown
Member

@lesteve lesteve Jun 24, 2020

Choose a reason for hiding this comment

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

Same thing here maybe this is enough?

Additional keyword arguments for the metric function.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also agree with @lesteve

Copy link
Copy Markdown
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

An additional comment to @lesteve review.


effective_metric_ : str
The effective metric used for the distance computation.
If `metric` is 'minkowski', `effective_metric_` is equivalent to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with Loic. The details should be given in the Parameters. Once it has been fitted, we just want to know that this the metric used.

n_samples_fit_ : int
It is the number of samples in the fitted data.

.. versionadded:: 0.20
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This version added should not be here. I assume it was belonging to the section of the parameter offset_.


effective_metric_params_ : dict
The effective additional keyword arguments for the metric function.
This is equivalent to `metric_params` in parameters if metric_params
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also agree with @lesteve

@j2heng
Copy link
Copy Markdown
Contributor Author

j2heng commented Jun 24, 2020

Thank you all for your reviews.
I made a new commit simplifying the attribute descriptions.

@cmarmo
Copy link
Copy Markdown
Contributor

cmarmo commented Jun 25, 2020

@glemaitre, @lesteve, have comments been addressed? Thanks!

Copy link
Copy Markdown
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

Some more minor comments, other than that LGTM.

Comment on lines +161 to 166
n_samples_fit_ : int
It is the number of samples in the fitted data.



Examples
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In the docstring of other classes in the code base we do not insert extra blank lines between sections. Let's be consistent :

Suggested change
n_samples_fit_ : int
It is the number of samples in the fitted data.
Examples
n_samples_fit_ : int
It is the number of samples in the fitted data.
Examples

'OrthogonalMatchingPursuit',
'PLSCanonical', 'PLSSVD',
'PassiveAggressiveClassifier'}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's not edit lines that are unrelated to the change at hand. Our coding conventions tolerate this blank line, so let's keep it.

@glemaitre
Copy link
Copy Markdown
Member

You will need to merge master into your branch and solve the conflict (it should be in the list of estimator that should be bypass).

@lesteve
Copy link
Copy Markdown
Member

lesteve commented Jun 25, 2020

You will need to merge master into your branch and solve the conflict (it should be in the list of estimator that should be bypass).

I resolved the conflicts via the web UI. This works well enough IMO for simple conflicts.

@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Jun 25, 2020

@j2heng you will have to git pull --rebase origin branch_missing_attr_1 to pull the merge commit to your local clone before being able to push the commits to address the remaining comments.

@j2heng
Copy link
Copy Markdown
Contributor Author

j2heng commented Jun 25, 2020

I'm on it

@glemaitre glemaitre assigned glemaitre and unassigned glemaitre Jun 26, 2020
@ogrisel
Copy link
Copy Markdown
Member

ogrisel commented Jun 26, 2020

@j2heng you need to remove LocalOutlierFactor from the list of ignored class in the test that checks the attributes in docstrings.

@glemaitre
Copy link
Copy Markdown
Member

Uhm I might done this when handling the merge to master

@glemaitre glemaitre self-assigned this Jun 26, 2020
@glemaitre
Copy link
Copy Markdown
Member

@j2heng sorry about that this is good to be merged. Thanks

@glemaitre glemaitre merged commit 3491e07 into scikit-learn:master Jun 26, 2020
@j2heng j2heng deleted the branch_missing_attr_1 branch June 26, 2020 12:10
glemaitre added a commit to glemaitre/scikit-learn that referenced this pull request Jul 17, 2020
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
jayzed82 pushed a commit to jayzed82/scikit-learn that referenced this pull request Oct 22, 2020
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
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.

5 participants