[mlpack-svn] r17233 - mlpack/trunk/src/mlpack/methods/kmeans

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Oct 10 15:19:10 EDT 2014


Author: rcurtin
Date: Fri Oct 10 15:19:10 2014
New Revision: 17233

Log:
Add a warning if the user wants 0 clusters, because the thing is probably going
to crash (but maybe for some LloydIterationType that might be what's desired?).


Modified:
   mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/kmeans/kmeans_impl.hpp	Fri Oct 10 15:19:10 2014
@@ -89,6 +89,9 @@
   if (clusters > data.n_cols)
     Log::Warn << "KMeans::Cluster(): more clusters requested than points given."
         << std::endl;
+  else if (clusters == 0)
+    Log::Warn << "KMeans::Cluster(): zero clusters requested.  This probably "
+        << "isn't going to work.  Brace for crash." << std::endl;
 
   // Check validity of initial guess.
   if (initialGuess)



More information about the mlpack-svn mailing list