[mlpack-svn] r15532 - mlpack/conf/jenkins-conf/benchmark/methods/shogun

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Jul 23 13:11:27 EDT 2013


Author: marcus
Date: Tue Jul 23 13:11:26 2013
New Revision: 15532

Log:
Move the data set loading part into the constructor.

Modified:
   mlpack/conf/jenkins-conf/benchmark/methods/shogun/pca.py

Modified: mlpack/conf/jenkins-conf/benchmark/methods/shogun/pca.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/shogun/pca.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/shogun/pca.py	Tue Jul 23 13:11:26 2013
@@ -38,6 +38,10 @@
     self.verbose = verbose
     self.dataset = dataset
 
+    # Load input dataset.
+    Log.Info("Loading dataset", verbose)
+    self.data = np.genfromtxt(dataset, delimiter=',')
+
   '''
   Use the shogun libary to implement Principal Components Analysis.
 
@@ -49,20 +53,19 @@
     
     # Load input dataset.
     Log.Info("Loading dataset", self.verbose)
-    data = np.genfromtxt(self.dataset, delimiter=',')
-    feat = RealFeatures(data.T)
+    feat = RealFeatures(self.data.T)
 
     with totalTimer:
       # Find out what dimension we want.
       match = re.search('-d (\d+)', options)
 
       if not match:
-        k = data.shape[1]
+        k = self.data.shape[1]
       else:
         k = int(match.group(1))      
-        if (k > data.shape[1]):
-          Log.Fatal("New dimensionality (" + str(k) + ") cannot be greater "
-              + "than existing dimensionality (" + str(data.shape[1]) + ")!")
+        if (k > self.data.shape[1]):
+          Log.Fatal("New dimensionality (" + str(k) + ") cannot be greater than"
+              + "existing dimensionality (" + str(self.data.shape[1]) + ")!")
           return -1
 
       # Get the options for running PCA.



More information about the mlpack-svn mailing list