[mlpack-svn] r16806 - mlpack/trunk/src/mlpack/methods/perceptron

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Jul 10 09:49:09 EDT 2014


Author: saxena.udit
Date: Thu Jul 10 09:49:08 2014
New Revision: 16806

Log:
Minor improvement. No major functionality changes

Modified:
   mlpack/trunk/src/mlpack/methods/perceptron/perceptron_impl.hpp

Modified: mlpack/trunk/src/mlpack/methods/perceptron/perceptron_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/methods/perceptron/perceptron_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/methods/perceptron/perceptron_impl.hpp	Thu Jul 10 09:49:08 2014
@@ -49,7 +49,6 @@
   bool converged = false;
   size_t tempLabel;
   arma::uword maxIndexRow, maxIndexCol;
-  double maxVal;
   arma::mat tempLabelMat;
 
   LearnPolicy LP;
@@ -68,8 +67,8 @@
       // correctly classifies this.
       tempLabelMat = weightVectors * trainData.col(j);
 
-      maxVal = tempLabelMat.max(maxIndexRow, maxIndexCol);
-      maxVal *= 2;
+      tempLabelMat.max(maxIndexRow, maxIndexCol);
+      
       // Check whether prediction is correct.
       if (maxIndexRow != classLabels(0, j))
       {
@@ -100,15 +99,13 @@
 {
   arma::mat tempLabelMat;
   arma::uword maxIndexRow, maxIndexCol;
-  double maxVal;
 
   for (int i = 0; i < test.n_cols; i++)
   {
-    tempLabelMat = weightVectors.submat(0,1,weightVectors.n_rows-1,
-                                        weightVectors.n_cols-1) * 
+    tempLabelMat = weightVectors.submat(0, 1, weightVectors.n_rows - 1,
+                                        weightVectors.n_cols - 1) * 
                                         test.col(i) + weightVectors.col(0);
-    maxVal = tempLabelMat.max(maxIndexRow, maxIndexCol);
-    maxVal *= 2;
+    tempLabelMat.max(maxIndexRow, maxIndexCol);
     predictedLabels(0, i) = maxIndexRow;
   }
 }



More information about the mlpack-svn mailing list