-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
CLN Cleaned TreeUnionFind
in _hdbscan/_tree.pyx
#25827
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
CLN Cleaned TreeUnionFind
in _hdbscan/_tree.pyx
#25827
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.
LGTM. Thank you, @Micky774.
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
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.
Thanks for the PR!
sklearn/cluster/_hdbscan/_tree.pyx
Outdated
cdef union_(self, cnp.intp_t x, cnp.intp_t y): | ||
cdef cnp.ndarray[cnp.intp_t, ndim=2] data_arr | ||
data_arr = np.zeros((size, 2), dtype=np.intp) | ||
data_arr.T[0] = np.arange(size) |
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.
Seems a little waste to create a new array just for setting the values of another array. What is the performance like for doing it manually for large size
?
for i in range(size):
data_arr[i, 0] = i
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
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
Reference Issues/PRs
Towards #24686
What does this implement/fix? Explain your changes.
Any other comments?