Clustering with sample averaging