[mlpack-svn] r13198 - mlpack/trunk/src/mlpack/methods/det

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jul 10 16:56:39 EDT 2012


Author: rcurtin
Date: 2012-07-10 16:56:39 -0400 (Tue, 10 Jul 2012)
New Revision: 13198

Modified:
   mlpack/trunk/src/mlpack/methods/det/dtree_impl.hpp
Log:
Simplification of expression


Modified: mlpack/trunk/src/mlpack/methods/det/dtree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/det/dtree_impl.hpp	2012-07-10 20:55:42 UTC (rev 13197)
+++ mlpack/trunk/src/mlpack/methods/det/dtree_impl.hpp	2012-07-10 20:56:39 UTC (rev 13198)
@@ -21,12 +21,9 @@
 double DTree<eT, cT>::LogNegativeError(size_t total_points)
 {
   // log(-|t|^2 / (N^2 V_t)) = log(-1) + 2 log(|t|) - 2 log(N) - log(V_t).
-  double error = 2 * std::log((double) (end_ - start_)) -
-                 2 * std::log((double) total_points);
-  for (size_t i = 0; i < max_vals_->n_elem; ++i)
-    error -= std::log((*max_vals_)[i] - (*min_vals_)[i]);
-
-  return error;
+  return 2 * std::log((double) (end_ - start_)) -
+         2 * std::log((double) total_points) -
+         arma::accu(arma::log((*max_vals_) - (*min_vals_)));
 }
 
 // This function finds the best split with respect to the L2-error,




More information about the mlpack-svn mailing list