-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
DOC improve docstring in OPTICS functions compute_optics_graph #22024
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
DOC improve docstring in OPTICS functions compute_optics_graph #22024
Conversation
There was a problem hiding this 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.
sklearn/cluster/_optics.py
Outdated
@@ -68,7 +68,7 @@ class OPTICS(ClusterMixin, BaseEstimator): | |||
should take two arrays as input and return one value indicating the | |||
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. |
There was a problem hiding this comment.
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.
"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. |
sklearn/cluster/_optics.py
Outdated
@@ -405,9 +405,9 @@ def compute_optics_graph( | |||
Parameters | |||
---------- | |||
X : ndarray of shape (n_samples, n_features), or \ | |||
(n_samples, n_samples) if metric=’precomputed’. | |||
(n_samples, n_samples) if metric=’precomputed’ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These quotes are weird.
(n_samples, n_samples) if metric=’precomputed’ | |
(n_samples, n_samples) if metric="precomputed" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point
So this is not a big deal for this PR. But be aware that you did not created a branch from I closed #22024 and we will merge both changes. If you want to do new PR in the future, please |
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. |
Thanks @Moonkyung94 |
Reference Issues/PRs
#21350
What does this implement/fix? Explain your changes.
End the sentence with a period.
Any other comments?