/*
* Store the document the loops have selected in the 'doc' variable.
* Store is vector in the 'docVec' variable for easy access.
*/
Instance doc = this.assignedClusters[clusterNum].get(docNum);
HashSparseVector docVec = (HashSparseVector) doc.getData();
int bestClusterNum = clusterNum; // Assume we are already in the best cluster.
double distanceToCurrentCentroid =
this.centroids[clusterNum].distanceEuclidean(docVec);
double squareDistanceOfBestCluster = distanceToCurrentCentroid;