Caster / growing-glyphs

Implementation accompanying A Practical Algorithm for Spatial Agglomerative Clustering
1 stars 0 forks source link

Double == Double always yields false #1

Closed stardisblue closed 3 years ago

stardisblue commented 3 years ago

Hello, after tinkering with the code: https://github.com/Caster/growing-glyphs/blob/fc4d25133d74ebc6a2db803f0dc8ef2183fa8fb7/src/algorithm/FirstMergeRecorder.java#L381 Is never true since Double objects are not == with each-other in Java.

Caster commented 3 years ago

Thank you for the feedback, @stardisblue! Out of curiosity, did you encounter odd behavior, or were you looking through the code when encountering this? I think this case seldomly occurs, so it might be good to find a test case that triggers it.

As to resolving this: I believe using Utils.Double#eq would fix this, agreed?

stardisblue commented 3 years ago

It triggers during csv/glottovis.tsv using big as a strategy. I had different stats when I fixed it...

stardisblue commented 3 years ago

btw, i'm wondering about two things :

  1. how would you stop the clustering at a certain step (for example, i don't need to calculate until full convergence but just until 1 equals 10base units).
  2. I have trouble extracting the result value of the clustering ; in accordance to step1. Since it gives me the ultimate cluster.
Caster commented 3 years ago

Let me answer your followup questions in #2, @stardisblue :slightly_smiling_face: