Skip to content

DOC improve docstring in OPTICS functions compute_optics_graph#22024

Merged
glemaitre merged 4 commits intoscikit-learn:mainfrom
moonkyung-kang:sklearn.cluster._optics.compute_optics_graph
Jan 24, 2022
Merged

DOC improve docstring in OPTICS functions compute_optics_graph#22024
glemaitre merged 4 commits intoscikit-learn:mainfrom
moonkyung-kang:sklearn.cluster._optics.compute_optics_graph

Conversation

@moonkyung-kang
Copy link
Copy Markdown
Contributor

Reference Issues/PRs

#21350

What does this implement/fix? Explain your changes.

End the sentence with a period.

Any other comments?

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.

Otherwise LGTM. The error that you get will be fixed once #22028 is merged.

distance between them. This works for Scipy's metrics, but is less
efficient than passing the metric name as a string. If metric is
"precomputed", X is assumed to be a distance matrix and must be square.
"precomputed", 'X' is assumed to be a distance matrix and must be square.
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.

It would be better to use the following.

Suggested change
"precomputed", 'X' is assumed to be a distance matrix and must be square.
"precomputed", `X` is assumed to be a distance matrix and must be square.

----------
X : ndarray of shape (n_samples, n_features), or \
(n_samples, n_samples) if metric=’precomputed’.
(n_samples, n_samples) if metric=’precomputed’
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.

These quotes are weird.

Suggested change
(n_samples, n_samples) if metric=precomputed
(n_samples, n_samples) if metric="precomputed"

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.

What do you think if we use instead:
(n_samples, n_samples) if metric='precomputed'

I think it is more consistent with the rest of the code.

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.

Good point

@glemaitre
Copy link
Copy Markdown
Member

So this is not a big deal for this PR. But be aware that you did not created a branch from main when creating this branch. Thus you have changes from the PR #22024.

I closed #22024 and we will merge both changes.

If you want to do new PR in the future, please checkout (also git switch works now) to main. Then, pull the last changes from the scikit-learn repository and create a new branch.

@glemaitre glemaitre self-assigned this Jan 24, 2022
@glemaitre glemaitre changed the title DOC Ensures that sklearn.cluster. optics.compute optics graph numpydoc validation DOC improve docstring in OPTICS functions Jan 24, 2022
@glemaitre
Copy link
Copy Markdown
Member

I see that another PR was merged that fixed most of the issues. There is still a couple of nitpicking improvements that I will merge even if they are not required to pass the NumPy doc test.

@glemaitre glemaitre merged commit ac6273e into scikit-learn:main Jan 24, 2022
@glemaitre
Copy link
Copy Markdown
Member

Thanks @Moonkyung94

@thomasjpfan thomasjpfan changed the title DOC improve docstring in OPTICS functions DOC improve docstring in OPTICS functions compute_optics_graph Mar 19, 2022
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.

3 participants