[mlpack-svn] r15409 - in mlpack/conf/jenkins-conf/benchmark/methods: mlpack mlpy scikit shogun

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Thu Jul 4 09:02:57 EDT 2013


Author: marcus
Date: Thu Jul  4 09:02:56 2013
New Revision: 15409

Log:
There is no need to measure the loading time, measure the total time at the right position.

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

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpack/nbc.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpack/nbc.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpack/nbc.py	Thu Jul  4 09:02:56 2013
@@ -119,9 +119,8 @@
 		# Compile the regular expression pattern into a regular expression object to
 		# parse the timer data.
 		pattern = re.compile(r"""
-				.*?loading_data: (?P<loading_time>.*?)s.*?
-				.*?saving_data: (?P<saving_time>.*?)s.*?
-				.*?total_time: (?P<total_time>.*?)s.*?
+				.*?testing: (?P<testing>.*?)s.*?
+				.*?training: (?P<training>.*?)s.*?
 				""", re.VERBOSE|re.MULTILINE|re.DOTALL)
 		
 		match = pattern.match(data)
@@ -130,12 +129,10 @@
 			return -1
 		else:
 			# Create a namedtuple and return the timer data.
-			timer = collections.namedtuple("timer", ["loading_time", "saving_time", 
-					"total_time"])
+			timer = collections.namedtuple("timer", ["testing", "training"])
 
-			return timer(float(match.group("loading_time")),
-					float(match.group("saving_time")),
-					float(match.group("total_time")))
+			return timer(float(match.group("testing")),
+					float(match.group("training")))
 
 	'''
 	Return the elapsed time in seconds.
@@ -144,5 +141,5 @@
 	@return Elapsed time in seconds.
 	'''
 	def GetTime(self, timer):
-		time = timer.total_time - timer.loading_time - timer.saving_time
+		time = timer.testing + timer.training
 		return time

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpy/pca.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpy/pca.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpy/pca.py	Thu Jul  4 09:02:56 2013
@@ -1,4 +1,4 @@
- '''
+'''
   @file pca.py
   @author Marcus Edel
 
@@ -51,13 +51,12 @@
   '''
   def PCASMlpy(self, options):
     totalTimer = Timer()
-    loadTimer = Timer()
-    with totalTimer:
-      # Load input dataset.
-      with loadTimer:
-        Log.Info("Loading dataset", self.verbose)
-        data = np.genfromtxt(self.dataset, delimiter=',')
 
+    # Load input dataset.
+    Log.Info("Loading dataset", self.verbose)
+    data = np.genfromtxt(self.dataset, delimiter=',')
+
+    with totalTimer:
       # Find out what dimension we want.
       match = re.search('-d (\d+)', options)
 
@@ -78,7 +77,7 @@
       prep.learn(data)
       prep.transform(data)      
 
-    return (totalTimer.ElapsedTime() - loadTimer.ElapsedTime())
+    return totalTimer.ElapsedTime()
 
   '''
   Perform Principal Components Analysis. If the method has been successfully 

Modified: mlpack/conf/jenkins-conf/benchmark/methods/scikit/pca.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/scikit/pca.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/scikit/pca.py	Thu Jul  4 09:02:56 2013
@@ -1,4 +1,4 @@
- '''
+'''
   @file pca.py
   @author Marcus Edel
 
@@ -51,13 +51,12 @@
   '''
   def PCAScikit(self, options):
     totalTimer = Timer()
-    loadTimer = Timer()
-    with totalTimer:
-      # Load input dataset.
-      with loadTimer:
-        Log.Info("Loading dataset", self.verbose)
-        data = np.genfromtxt(self.dataset, delimiter=',')
 
+    # Load input dataset.
+    Log.Info("Loading dataset", self.verbose)
+    data = np.genfromtxt(self.dataset, delimiter=',')
+
+    with totalTimer:
       # Find out what dimension we want.
       match = re.search('-d (\d+)', options)
 
@@ -78,7 +77,7 @@
       pca.fit(data)
       score = pca.transform(data)
 
-    return (totalTimer.ElapsedTime() - loadTimer.ElapsedTime())
+    return totalTimer.ElapsedTime()
 
   '''
   Perform Principal Components Analysis. If the method has been successfully 

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	Thu Jul  4 09:02:56 2013
@@ -1,4 +1,4 @@
- '''
+'''
   @file pca.py
   @author Marcus Edel
 
@@ -52,14 +52,13 @@
   '''
   def PCAShogun(self, options):
     totalTimer = Timer()
-    loadTimer = Timer()
-    with totalTimer:
-      # Load input dataset.
-      with loadTimer:
-        Log.Info("Loading dataset", self.verbose)
-        data = np.genfromtxt(self.dataset, delimiter=',')
-        feat = RealFeatures(data.T)
+    
+    # Load input dataset.
+    Log.Info("Loading dataset", self.verbose)
+    data = np.genfromtxt(self.dataset, delimiter=',')
+    feat = RealFeatures(data.T)
 
+    with totalTimer:
       # Find out what dimension we want.
       match = re.search('-d (\d+)', options)
 
@@ -81,7 +80,7 @@
       prep.init(feat)
       prep.apply_to_feature_matrix(feat)
 
-    return (totalTimer.ElapsedTime() - loadTimer.ElapsedTime())
+    return totalTimer.ElapsedTime()
 
   '''
   Perform Principal Components Analysis. If the method has been successfully 



More information about the mlpack-svn mailing list