You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thinks the intention here is to implement path compression, but it could be that this code only does 1/k of the total optimization because of the way the tuple assignment works. Here "k" would be the number of hops from this node up to the root. If I'm right, this would make a big difference for large datasets where the MST is fairly large.
If I understand python correctly (debatable!), the right side tuple is evaluated from left to right, and then the left side assignments are made from left to right. That means that means that p on the left is updated before self.parent[p] is updated, which I do not believe is the intended behavior.
I think the following code will work correctly. I can probably fork and test this code over the weekend, but hoping Leland or another author can maybe clarify before I dig in too much.
while self.parent_arr[p] != n:
#p, self.parent_arr[p] = self.parent_arr[p], n
tmp = self.parent_arr[p]
self.parent_arr[p] = n
p = tmp
return n
Thanks in advance for spending time looking at this!
The text was updated successfully, but these errors were encountered:
markopy
added a commit
to markopy/hdbscan
that referenced
this issue
Oct 3, 2020
hdbscan/hdbscan/_hdbscan_linkage.pyx
Line 193 in d3da6a7
I thinks the intention here is to implement path compression, but it could be that this code only does 1/k of the total optimization because of the way the tuple assignment works. Here "k" would be the number of hops from this node up to the root. If I'm right, this would make a big difference for large datasets where the MST is fairly large.
If I understand python correctly (debatable!), the right side tuple is evaluated from left to right, and then the left side assignments are made from left to right. That means that means that p on the left is updated before self.parent[p] is updated, which I do not believe is the intended behavior.
I think the following code will work correctly. I can probably fork and test this code over the weekend, but hoping Leland or another author can maybe clarify before I dig in too much.
Thanks in advance for spending time looking at this!
The text was updated successfully, but these errors were encountered: