Skip to content

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

Merged
merged 8 commits into from
Mar 14, 2023

Conversation

Micky774
Copy link
Contributor

Reference Issues/PRs

Towards #24686

What does this implement/fix? Explain your changes.

  1. Updated data arrays to utilize memoryviews
  2. Improved removed trailing underscore
  3. Trimmed extraneous method

Any other comments?

Copy link
Member

@jjerphan jjerphan left a 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>
Copy link
Member

@thomasjpfan thomasjpfan left a 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!

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)
Copy link
Member

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

Copy link
Member

@thomasjpfan thomasjpfan left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasjpfan thomasjpfan merged commit 1a751b6 into scikit-learn:hdbscan Mar 14, 2023
@Micky774 Micky774 deleted the hdbscan_treeunion_clean branch March 14, 2023 22:03
Micky774 added a commit to Micky774/scikit-learn that referenced this pull request May 16, 2023
Co-authored-by: Julien Jerphanion <git@jjerphan.xyz>
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