[mlpack-git] master, mlpack-1.0.x: Get the number of classes correctly. (47bb810)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:46:16 EST 2015
Repository : https://github.com/mlpack/mlpack
On branches: master,mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit 47bb810130fa043913ed28fd6f1d1e1469b40f12
Author: Ryan Curtin <ryan at ratml.org>
Date: Mon Apr 14 19:26:36 2014 +0000
Get the number of classes correctly.
>---------------------------------------------------------------
47bb810130fa043913ed28fd6f1d1e1469b40f12
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.
More information about the mlpack-git
mailing list