[mlpack] 04/22: Get the number of classes correctly.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Thu Apr 17 12:23:01 UTC 2014


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

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

commit 201d5437c5fffc4ab1f48fb0a3a5c25bd1e2cc0b
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Mon Apr 14 19:26:36 2014 +0000

    Get the number of classes correctly.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16424 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/naive_bayes/nbc_main.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/mlpack/methods/naive_bayes/nbc_main.cpp b/src/mlpack/methods/naive_bayes/nbc_main.cpp
index 12d43fe..cd1fac9 100644
--- a/src/mlpack/methods/naive_bayes/nbc_main.cpp
+++ b/src/mlpack/methods/naive_bayes/nbc_main.cpp
@@ -80,12 +80,9 @@ int main(int argc, char* argv[])
         << "must be the same as training data (" << trainingData.n_rows - 1
         << ")!" << std::endl;
 
-  // Calculate number of classes.
-  size_t classes = (size_t) max(trainingData.row(trainingData.n_rows - 1)) + 1;
-
   // Create and train the classifier.
   Timer::Start("training");
-  NaiveBayesClassifier<> nbc(trainingData, labels, classes);
+  NaiveBayesClassifier<> nbc(trainingData, labels, mappings.n_elem);
   Timer::Stop("training");
 
   // Time the running of the Naive Bayes Classifier.

-- 
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