Skip to content

Commit

Permalink
Ensure int casts in condensed tree #600
Browse files Browse the repository at this point in the history
  • Loading branch information
lmcinnes committed Jul 17, 2023
1 parent dd27600 commit 7611cfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hdbscan/_hdbscan_tree.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ cpdef np.ndarray condense_tree(np.ndarray[np.double_t, ndim=2] hierarchy,
lambda_value = INFTY

if left >= num_points:
left_count = <np.intp_t> hierarchy[left - num_points][3]
left_count = <np.intp_t> int(hierarchy[left - num_points][3])

This comment has been minimized.

Copy link
@shubhambagalsrb

shubhambagalsrb Jul 18, 2023

It is not working. can you remove <np.intp_t>

This comment has been minimized.

Copy link
@lmcinnes

lmcinnes Jul 18, 2023

Author Collaborator

Not unless you want it to break in other places later unfortunately. This does seem to work for a number of people, so it at least does something useful.

This comment has been minimized.

Copy link
@shubhambagalsrb

shubhambagalsrb Jul 18, 2023

while clustering i am getting error as numpy.float64 object cannot be interpreted as integer. can you help me with it

else:
left_count = 1

if right >= num_points:
right_count = <np.intp_t> hierarchy[right - num_points][3]
right_count = <np.intp_t> int(hierarchy[right - num_points][3])
else:
right_count = 1

Expand Down

0 comments on commit 7611cfe

Please sign in to comment.