[mlpack-svn] r15522 - mlpack/conf/jenkins-conf/benchmark/methods/mlpy

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Jul 22 08:58:48 EDT 2013


Author: marcus
Date: Mon Jul 22 08:58:47 2013
New Revision: 15522

Log:
Clean up mlpy scripts.

Modified:
   mlpack/conf/jenkins-conf/benchmark/methods/mlpy/allknn.py
   mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kernel_pca.py
   mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kmeans.py
   mlpack/conf/jenkins-conf/benchmark/methods/mlpy/lars.py
   mlpack/conf/jenkins-conf/benchmark/methods/mlpy/linear_regression.py
   mlpack/conf/jenkins-conf/benchmark/methods/mlpy/pca.py

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpy/allknn.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpy/allknn.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpy/allknn.py	Mon Jul 22 08:58:47 2013
@@ -38,12 +38,6 @@
     self.dataset = dataset
 
   '''
-  Destructor to clean up at the end.
-  '''
-  def __del__(self):
-    pass
-
-  '''
   Use the mlpy libary to implement All K-Nearest-Neighbors.
 
   @param options - Extra options for the method.

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kernel_pca.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kernel_pca.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kernel_pca.py	Mon Jul 22 08:58:47 2013
@@ -38,12 +38,6 @@
     self.dataset = dataset
 
   '''
-  Destructor to clean up at the end.
-  '''
-  def __del__(self):
-    pass
-
-  '''
   Use the mlpy libary to implement Kernel Principal Components Analysis.
 
   @param options - Extra options for the method.
@@ -76,11 +70,8 @@
           return -1
       elif kernel.group(1) == "polynomial":
         degree = re.search('-D (\d+)', options)
-        if not degree:
-          degree = 1
-        else:
-          degree = int(degree.group(1))
-        
+        degree = 1 if not degree else int(degree.group(1))
+
         kernel = mlpy.kernel_polynomial(data, data, d=degree)
       elif kernel.group(1) == "gaussian":
         kernel = mlpy.kernel_gaussian(data, data, sigma=2) 

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kmeans.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kmeans.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpy/kmeans.py	Mon Jul 22 08:58:47 2013
@@ -38,12 +38,6 @@
     self.dataset = dataset
 
   '''
-  Destructor to clean up at the end.
-  '''
-  def __del__(self):
-    pass
-
-  '''
   Use the mlpy libary to implement K-Means Clustering.
 
   @param options - Extra options for the method.
@@ -56,7 +50,7 @@
     Log.Info("Loading dataset", self.verbose)
     data = np.genfromtxt(self.dataset, delimiter=',')
 
-    # Gather parameters.
+    # Gather all parameters.
     clusters = re.search('-c (\d+)', options)
     seed = re.search("-s (\d+)", options)
 
@@ -64,7 +58,7 @@
     if not clusters:
       Log.Fatal("Required option: Number of clusters or cluster locations.")
       return -1
-    elif clusters.group(1) < 1:
+    elif int(clusters.group(1)) < 1:
       Log.Fatal("Invalid number of clusters requested! Must be greater than or "
           + "equal to 1.")
       return -1

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpy/lars.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpy/lars.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpy/lars.py	Mon Jul 22 08:58:47 2013
@@ -38,12 +38,6 @@
     self.dataset = dataset
 
   '''
-  Destructor to clean up at the end.
-  '''
-  def __del__(self):
-    pass
-
-  '''
   Use the mlpy libary to implement Least Angle Regression.
 
   @param options - Extra options for the method.
@@ -76,7 +70,7 @@
     Log.Info("Perform LARS.", self.verbose)
 
     if len(self.dataset) < 2:
-      Log.Fatal("The method need two datasets.")
+      Log.Fatal("This method requires two datasets.")
       return -1
 
     return self.LARSMlpy(options)

Modified: mlpack/conf/jenkins-conf/benchmark/methods/mlpy/linear_regression.py
==============================================================================
--- mlpack/conf/jenkins-conf/benchmark/methods/mlpy/linear_regression.py	(original)
+++ mlpack/conf/jenkins-conf/benchmark/methods/mlpy/linear_regression.py	Mon Jul 22 08:58:47 2013
@@ -38,12 +38,6 @@
     self.dataset = dataset
 
   '''
-  Destructor to clean up at the end.
-  '''
-  def __del__(self):
-    pass
-
-  '''
   Use the mlpy libary to implement Linear Regression.
 
   @param options - Extra options for the method.

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	Mon Jul 22 08:58:47 2013
@@ -38,12 +38,6 @@
     self.dataset = dataset
 
   '''
-  Destructor to clean up at the end.
-  '''
-  def __del__(self):
-    pass
-
-  '''
   Use the mlpy libary to implement Principal Components Analysis.
 
   @param options - Extra options for the method.



More information about the mlpack-svn mailing list