[mlpack-svn] r16987 - mlpack/trunk/src/mlpack/methods/adaboost

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Aug 7 11:42:44 EDT 2014


Author: rcurtin
Date: Thu Aug  7 11:42:44 2014
New Revision: 16987

Log:
Simplify a matrix calculation.


Modified:
   mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/adaboost/adaboost_impl.hpp	Thu Aug  7 11:42:44 2014
@@ -108,15 +108,7 @@
 
     // Now, start calculation of alpha(t) using ht
 
-    // begin calculation of rt
-
-    for (j = 0; j < ht.n_rows; j++)
-    {
-      for (k = 0; k < ht.n_cols; k++)
-        rt += (D(j, k) * yt(j, k) * ht(j, k));
-    }
-    // end calculation of rt
-    // std::cout<<"Value of rt is: "<<rt<<"\n";
+    rt += arma::accu(D % yt % ht);
 
     if (i > 0)
     {
@@ -180,9 +172,9 @@
 {
   int i, j;
 
-  for (i = 0;i < t.n_rows; i++)
+  for (i = 0; i < t.n_rows; i++)
   {
-    for (j = 0;j < t.n_cols; j++)
+    for (j = 0; j < t.n_cols; j++)
     {
       if (j == l(i))
         t(i, j) = 1.0;



More information about the mlpack-svn mailing list