0
$\begingroup$

I have a series of 2D coordinates X = {x, y}. Each are associated with one categorical variable W that can take 7 different values.

E.g:

coord  W
X1     3
X2     5
X3     7
X4     3 
X5     2
X6     3 
X7     2 
... 
X2000  5 
... 

I would like to get all the clusters that belong to a given set of my categorical variable within 2 pixels of each other. Say, for the triplet of W values (2, 5, 7), or a tuplet of all values (1,2,3,4,5,6,7), I want to have all the sets (if any) of coordinates that are within 2 pixels of each other. What would be the most appropriate methods?

Also, there are no singletons, all these coordinates have at least another nearest neighbour with a different W value. I only know how to do this to only find the sets of pairs of coordinates for 2 different W values (using pair-wise euclidian distance matrix), but to get clusters of more elements for more than 2 of my W values, I am confused about what clustering method to use (and if that actually falls in the realm of clustering at all...), as that seems rather basic and I keep reading about rather sophisticated approaches that look overkill (KNN, HDBSCAN, ...).

$\endgroup$
0
$\begingroup$

This isn't a clustering problem. Within each set (like W=3), you simply sort them by x coordinate and then y coordinate too. Find the points +/- 2 pixels in the x dimension, then in the y dimension, and take the points that are in both. This ought to be linear within a sorted list.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.