-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
DOC Update _hdbscan/_linkage.pyx
with new inline comments
#25656
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
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.
I'm always concerned with having inline comments that appear between every line of code. They often describe "what" the code is doing and not "why". In these cases, I prefer to improve the code itself, either by simplifying the code or having better variable names.
min_reachability = np.full(n_samples, fill_value=np.infty, dtype=np.float64) | ||
for i in range(0, n_samples - 1): | ||
# Sub-select nodes not-yet in the tree |
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.
Can this be communicate with a better variable name for label_filter
?
# Compute the nodes' current min-reachability scores | ||
left = min_reachability[label_filter] | ||
# Compute the nodes' mutual-reachability to current node | ||
right = mutual_reachability[current_node][current_labels] |
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.
left
and right
are not computing anything. Is there a better name for left
and right
such that the comment is not required?
# Update min-reachability, given the new mutual-reachability of all | ||
# nodes from the current node. |
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.
Also would a better name for left
and right
remove the need for this comment?
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.
LGTM once @thomasjpfan's comments are addressed. Thank you, @Micky774.
Moreover, can you add a TODO
to state that mst_from_data_matrix
can be backed later by a PairwiseDistancesReduction
back-end?
FYI, I have added an item to #22587. |
Reference Issues/PRs
Follow-up to #24857
What does this implement/fix? Explain your changes.
Improves in-line comments to address algorithm steps directly
Any other comments?