[mlpack-svn] r10425 - mlpack/trunk/src/mlpack/methods/kmeans
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sun Nov 27 01:32:17 EST 2011
Author: rcurtin
Date: 2011-11-27 01:32:16 -0500 (Sun, 27 Nov 2011)
New Revision: 10425
Modified:
mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
mlpack/trunk/src/mlpack/methods/kmeans/max_variance_new_cluster.cpp
Log:
You have to zero the counts first!
Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2011-11-27 03:27:14 UTC (rev 10424)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2011-11-27 06:32:16 UTC (rev 10425)
@@ -85,6 +85,7 @@
arma::mat centroids(data.n_rows, actualClusters);
// Counts of points in each cluster.
arma::Col<size_t> counts(actualClusters);
+ counts.zeros();
// Set counts correctly.
for (size_t i = 0; i < assignments.n_elem; i++)
Modified: mlpack/trunk/src/mlpack/methods/kmeans/max_variance_new_cluster.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/max_variance_new_cluster.cpp 2011-11-27 03:27:14 UTC (rev 10424)
+++ mlpack/trunk/src/mlpack/methods/kmeans/max_variance_new_cluster.cpp 2011-11-27 06:32:16 UTC (rev 10425)
@@ -58,5 +58,9 @@
clusterCounts[emptyCluster]++;
assignments[furthestPoint] = emptyCluster;
+ // Output some debugging information.
+ Log::Debug << "Point " << furthestPoint << " assigned to empty cluster " <<
+ emptyCluster << ".\n";
+
return 1; // We only changed one point.
}
More information about the mlpack-svn
mailing list