[mlpack-svn] r14916 - mlpack/trunk/src/mlpack/methods/kmeans
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Apr 18 14:18:53 EDT 2013
Author: rcurtin
Date: 2013-04-18 14:18:53 -0400 (Thu, 18 Apr 2013)
New Revision: 14916
Modified:
mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
Log:
Fix bug in error checking, and make given errors a little more descriptive.
Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2013-04-18 15:37:43 UTC (rev 14915)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp 2013-04-18 18:18:53 UTC (rev 14916)
@@ -539,16 +539,19 @@
}
// Now, the initial assignments. First determine if they are necessary.
- if (initialAssignmentGuess && assignments.n_cols != data.n_cols)
+ if (initialAssignmentGuess && assignments.n_elem != data.n_cols)
{
- Log::Fatal << "KMeans::Cluster(): initial cluster assignments not the same "
- << "size as the dataset!" << std::endl;
+ Log::Fatal << "KMeans::Cluster(): initial cluster assignments (length "
+ << assignments.n_elem << ") not the same size as the dataset (size "
+ << data.n_cols << ")!" << std::endl;
}
else if (initialCentroidGuess && (centroids.n_rows != data.n_rows ||
centroids.n_cols != clusters))
{
Log::Fatal << "KMeans::Cluster(): wrong number of initial cluster centroids"
- << " or wrong dimensionality!" << std::endl;
+ << " (" << centroids.n_cols << ", should be " << clusters << ") or "
+ << "wrong dimensionality (" << centroids.n_rows << ", should be "
+ << data.n_rows << ")!" << std::endl;
}
else
{
More information about the mlpack-svn
mailing list