8000 FIX Updated loop structure in hdbscan `_tree.pyx` to avoid error by Micky774 · Pull Request #26547 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

FIX Updated loop structure in hdbscan _tree.pyx to avoid error #26547

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 3 commits into from
Jun 9, 2023

Conversation

Micky774
Copy link
Contributor
@Micky774 Micky774 commented Jun 8, 2023

Reference Issues/PRs

Fixes #26541

What does this implement/fix? Explain your changes.

For some reason, for-each style iteration of structured dtype numpy arrays no longer works. This PR replaces that loop usage with standard indexing. It may be worth investigating what caused it upstream.

Any other comments?

@Micky774
Copy link
Contributor Author
Micky774 commented Jun 8, 2023

cc: @jeremiedbb @lesteve

Comment on lines +257 to +258
for idx in range(PyArray_SHAPE(<cnp.PyArrayObject*> condensed_tree)[0]):
condensed_node = condensed_tree[idx]
Copy link
Member

Choose a reason for hiding this comment

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

Why do you need that ? I'd expect condensed_tree.shape[0] to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the new NumPy API the use of .shape errors.

See: #26385 (comment)

Copy link
Member
@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

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

LGTM if CI is green.

@lesteve
Copy link
Member
lesteve commented Jun 9, 2023

Locally test_hdbscan.py passes, I triggered a scipy-dev build just in case.

For some reason, for-each style iteration of structured dtype numpy arrays no longer works.

Hmmm weird, out of curiosity can you elaborate on this? In particular how do we get a float instead of an int eventually?

@lesteve
Copy link
Member
lesteve commented Jun 9, 2023

Ooops sorry, this issue is about pypy. Since I was pinged, I thought this was about scipy-dev #26535 my bad 😅 ...

@lesteve
Copy link
Member
lesteve commented Jun 9, 2023

Merging, thanks!

@lesteve lesteve merged commit ab48408 into scikit-learn:main Jun 9, 2023
manudarmi pushed a commit to primait/scikit-learn that referenced this pull request Jun 12, 2023
@Micky774 Micky774 deleted the hdbscan_pypy branch June 19, 2023 15:02
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
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.

HDBSCAN tests are failing on pypy
4 participants
0