[mlpack-git] master: Make lines 80 columns wide. (672786f)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Sun Dec 13 22:54:38 EST 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/d3b7d2ffaac8863ec477f6bd1a0dda031248b0e0...672786f499b8cc48ab1722de4544c1dc03af988a
>---------------------------------------------------------------
commit 672786f499b8cc48ab1722de4544c1dc03af988a
Author: Ryan Curtin <ryan at ratml.org>
Date: Sun Dec 13 22:54:24 2015 -0500
Make lines 80 columns wide.
>---------------------------------------------------------------
672786f499b8cc48ab1722de4544c1dc03af988a
src/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp b/src/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp
index b40719c..3526f7b 100644
--- a/src/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp
+++ b/src/mlpack/methods/naive_bayes/naive_bayes_classifier_impl.hpp
@@ -185,11 +185,13 @@ void NaiveBayesClassifier<MatType>::Classify(const MatType& data,
arma::mat diffs = data - arma::repmat(means.col(i), 1, data.n_cols);
arma::mat rhs = -0.5 * arma::diagmat(invVar.col(i)) * diffs;
arma::vec exponents(diffs.n_cols);
- for (size_t j = 0; j < diffs.n_cols; ++j)
- exponents(j) = arma::accu(diffs.col(j) % rhs.unsafe_col(j)); //log( exp (value) ) == value
+ for (size_t j = 0; j < diffs.n_cols; ++j) // log(exp(value)) == value
+ exponents(j) = arma::accu(diffs.col(j) % rhs.unsafe_col(j));
- //calculate prob as sum of logarithm to decrease floating point errors
- testProbs.col(i) += (data.n_rows / -2.0 * log(2 * M_PI) - 0.5 * log(arma::det(arma::diagmat(variances.col(i)))) + exponents);
+ // Calculate probability as sum of logarithm to decrease floating point
+ // errors.
+ testProbs.col(i) += (data.n_rows / -2.0 * log(2 * M_PI) - 0.5 *
+ log(arma::det(arma::diagmat(variances.col(i)))) + exponents);
}
// Now calculate the label.
More information about the mlpack-git
mailing list