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.").
For the one dimensional case, you can use the variance.

For the higher dimensions, you can generalize the variance by first computing a mean point and then computing the sum of the square of the distance between each point and the mean squared followed by a division the sum by the number of points. This division by the number of points (which also happens in the variance) is the difference between the solution you have suggested and what I am recommending.  This division allows for a fair comparison of clustering between sets of points of different sizes.

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