Extracting the cluster assignments