[mlpack-git] master, mlpack-1.0.x: Minor documentation fix, and sometimes the labels need to be transposed. (4817caf)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:46:12 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 4817caf8c0b019c6e8deedeb6674fb0168d58592
Author: Ryan Curtin <ryan at ratml.org>
Date: Mon Apr 14 19:16:06 2014 +0000
Minor documentation fix, and sometimes the labels need to be transposed.
>---------------------------------------------------------------
4817caf8c0b019c6e8deedeb6674fb0168d58592
src/mlpack/methods/naive_bayes/nbc_main.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/methods/naive_bayes/nbc_main.cpp b/src/mlpack/methods/naive_bayes/nbc_main.cpp
index adfcfa7..5620caa 100644
--- a/src/mlpack/methods/naive_bayes/nbc_main.cpp
+++ b/src/mlpack/methods/naive_bayes/nbc_main.cpp
@@ -25,8 +25,8 @@ PARAM_STRING_REQ("test_file", "A file containing the test set.", "T");
PARAM_STRING("labels_file", "A file containing labels for the training set.",
"l", "");
-PARAM_STRING("output", "The file in which the output of the test would "
- "be written, defaults to 'output.csv')", "o", "output.csv");
+PARAM_STRING("output", "The file in which the predicted labels for the test set"
+ " will be written.", "o", "output.csv");
using namespace mlpack;
using namespace mlpack::naive_bayes;
@@ -54,6 +54,10 @@ int main(int argc, char* argv[])
mat rawLabels;
data::Load(labelsFilename, rawLabels, true);
+ // Do the labels need to be transposed?
+ if (rawLabels.n_rows == 1)
+ rawLabels = rawLabels.t();
+
data::NormalizeLabels(rawLabels.unsafe_col(0), labels, mappings);
}
else
More information about the mlpack-git
mailing list