Closed Lambdanaut closed 5 years ago
Why would you create a list of Point2(math.inf, math.inf) ?
I'm doing some stuff with k-means where a cluster with 0 data points has a centroid of Math.inf. Sometimes, especially early in the game, none of my clusters have any data points, so it's a list of Math.inf.
If you think this is superfluous, then I'm okay with it not being merged.
I think it makes the function "safer" though
Its not up to me to decide.
I just thought its a very rare case.
We could also change
if distance < closest_distance_squared:
to
if distance <= closest_distance_squared:
I think that would be a "cleaner" fix.
I merged master into develop to start working on the dev branch. I fixed this issue while updating :) Develop branch should include a fix for your problem now.
I found myself needing to get the closest element in a list of points set at
Point2(math.inf, math.inf)
. This was failing with the following exceptionThis sets the closest element to be the first one before continuing onwards to the next elements, and also fixes my problem.