[mlpack] 27/149: 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?).

Barak A. Pearlmutter barak+git at pearlmutter.net
Sat May 2 09:11:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 7c0fb1ecf8eaa58f30dfd8c72633e4b2f083f38d
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Fri Oct 10 19:19:10 2014 +0000

    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?).
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17233 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/kmeans/kmeans_impl.hpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mlpack/methods/kmeans/kmeans_impl.hpp b/src/mlpack/methods/kmeans/kmeans_impl.hpp
index 87b42b2..7b8d9a3 100644
--- a/src/mlpack/methods/kmeans/kmeans_impl.hpp
+++ b/src/mlpack/methods/kmeans/kmeans_impl.hpp
@@ -89,6 +89,9 @@ Cluster(const MatType& data,
   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)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list