Scoring set of points based on clustering

I have a sparse set of points with unpredictable locations. I need a way of "scoring" each set of points such that clustering is rewarded. My working case is actually one dimensional, but a two dimensional use case may come up later.

Here's an example: Data A contains points at -2, 1, 5, 7. Data B has points at -10, 0, 20, 6. A and B are independent of each other and have not had clustering applied. Ideally, after clustering, A would have clusters (-2, 1) and (5, 7). There is more clustering in A so I would like it scored higher. Bonus points if the algorithm allows the points to have variable values so that in some cases, if points are 100 units apart but each of the points has a high value, that set of points will rate higher than a set of points 10 units apart with much lower values.

EDIT: My current idea is to use a clustering algorithm to figure out the center of each cluster and it figure out which points occupy the cluster. I would then score each cluster finding the mean of the distances squared (EDIT: Apparently this is called "variance.").

• Without more information, your proposed approach seems perfectly reasonable. – Suresh Venkat Jul 7 '11 at 23:54

For $n$ points with mean point $m$, the computation is $\frac{1}{n} \sum_{i=1}^n \operatorname{dist}(m, p_i)^2$.