There are two classes, let\'s call them X and O. A number of elements belonging to these classes are spread out in the xy-plane. Here is an example where the two classes are
In general that problem is NP-hard but there are good approximate solutions like K-means clustering.