Clustering / Grouping elements where each member meets a constraint

Not sure how to frame this question but here goes:

What I want to do:

From a bag of point of interests (POIs) with lat, long information, I want to create a cluster / group where each cluster / group contains some “x” number of members and the members are at least some “y” distance apart from all other members in the cluster / group.

I’ve been struggling with the Distance Matrix Calculate node and Similarity Search - I can get the “x” number of members and “y” distance apart for the first element - however, I can’t find a good way to filter the “y” distance between the other elements that Similarity Search has found for the first element.

Any suggestions would be great.

Hi @seoseokho83,
this is just an idea that came to my mind, I have never tried something like that: could you use the DBSCAN node to find the clusters and simply invert the distances, so that points that are further apart may fall into the same cluster?
Kind regards
Alexander

1 Like

Hi Alexander,

That’s actually a great idea. I’ve never thought of inverting the distance.

Is there a way to create a distance vector based on pairing data? Sort of a reverse “Distance Matrix Pair Extractor”?

I would use some form to calculate the distance between two pairs and inverse it, and then input it into the DBSCAN node as you suggested.

Thanks!

Hi,
you can define your own distance using different nodes. There is for example the Java Distance or Aggregated Distance for custom distances. You need to write a little bit of Java code, though.
Kind regards
Alexander

2 Likes

Hi Alex, one last question: is there a way to do an if-else statement in “Java Distance” node?

sort of…

if ( row > 1 ) { return 1;} else { return 2;}

Oops found a way to do it with “Aggregate Distance” node

ifElse($${D:Port_0}$$ <= 0.5, mean($${D:Port_0}$$, $${D:Port_1}$$), 1)

Thank you for the lead!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.