int numCols = columnCentroids.size();
Matrix confusionMatrix = new DenseMatrix(numRows, numCols);
for (Vector vector : datapoints) {
WeightedThing<Vector> closestRowCentroid = rowSearcher.search(vector, 1).get(0);
WeightedThing<Vector> closestColumnCentroid = columnSearcher.search(vector, 1).get(0);
int row = ((Centroid) closestRowCentroid.getValue()).getIndex();
int column = ((Centroid) closestColumnCentroid.getValue()).getIndex();
double vectorWeight;
if (vector instanceof WeightedVector) {
vectorWeight = ((WeightedVector) vector).getWeight();