mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gsing...@apache.org
Subject svn commit: r686745 [1/3] - in /lucene/mahout/trunk/examples/src: main/java/org/apache/mahout/ga/watchmaker/cd/ test/java/org/apache/mahout/ga/watchmaker/cd/ test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/ test/resources/ test/resources/wdbc/
Date Mon, 18 Aug 2008 13:11:13 GMT
Author: gsingers
Date: Mon Aug 18 06:11:12 2008
New Revision: 686745

URL: http://svn.apache.org/viewvc?rev=686745&view=rev
Log:
MAHOUT-56: minor updates to the GA examples

Added:
    lucene/mahout/trunk/examples/src/test/resources/wdbc/
    lucene/mahout/trunk/examples/src/test/resources/wdbc.infos
    lucene/mahout/trunk/examples/src/test/resources/wdbc/wdbc.data   (with props)
Modified:
    lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/DataLineTest.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java
    lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluatorTest.java

Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java?rev=686745&r1=686744&r2=686745&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
(original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
Mon Aug 18 06:11:12 2008
@@ -78,27 +78,36 @@
     int popSize = 10;
     int genCount = 10;
 
-    if (args.length == 8) {
+    if (args.length == 9) {
       dataset = args[0];
-      threshold = Double.parseDouble(args[1]);
-      crosspnts = Integer.parseInt(args[2]);
-      mutrate = Double.parseDouble(args[3]);
-      mutrange = Double.parseDouble(args[4]);
-      mutprec = Integer.parseInt(args[5]);
-      popSize = Integer.parseInt(args[6]);
-      genCount = Integer.parseInt(args[7]);
-    }
+      target = Integer.parseInt(args[1]);
+      threshold = Double.parseDouble(args[2]);
+      crosspnts = Integer.parseInt(args[3]);
+      mutrate = Double.parseDouble(args[4]);
+      mutrange = Double.parseDouble(args[5]);
+      mutprec = Integer.parseInt(args[6]);
+      popSize = Integer.parseInt(args[7]);
+      genCount = Integer.parseInt(args[8]);
+    } else {
+      System.out.println("Invalid arguments, working with default parameters instead");
+	}
 
-    runJob(dataset, threshold, crosspnts, mutrate, mutrange, mutprec, popSize,
-        genCount, target);
+    long start = System.currentTimeMillis();
+
+    runJob(dataset, target, threshold, crosspnts, mutrate, mutrange, mutprec,
+        popSize, genCount);
+
+    long end = System.currentTimeMillis();
+
+    printElapsedTime(end - start);
   }
 
-  private static void runJob(String dataset, double threshold, int crosspnts,
-                             double mutrate, double mutrange, int mutprec, int popSize, int
genCount, int target)
-      throws IOException {
+  private static void runJob(String dataset, int target, double threshold,
+      int crosspnts, double mutrate, double mutrange, int mutprec, int popSize,
+      int genCount) throws IOException {
     Path inpath = new Path(dataset);
     CDMahoutEvaluator.InitializeDataSet(inpath);
-    
+
     // Candidate Factory
     CandidateFactory factory = new CDFactory(threshold);
 

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/DataLineTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/DataLineTest.java?rev=686745&r1=686744&r2=686745&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/DataLineTest.java
(original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/DataLineTest.java
Mon Aug 18 06:11:12 2008
@@ -15,7 +15,7 @@
 
   public void testSet() throws Exception {
     FileSystem fs = FileSystem.get(new Configuration());
-    Path inpath = new Path("build/examples-test-classes/wdbc");
+    Path inpath = new Path("build/test-classes/wdbc");
     DataSet dataset = FileInfoParser.parseFile(fs, inpath);
     DataSet.initialize(dataset);
     

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java?rev=686745&r1=686744&r2=686745&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java
(original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/FileInfosDatasetTest.java
Mon Aug 18 06:11:12 2008
@@ -34,12 +34,12 @@
 
   public void testRanges() throws IOException {
     FileSystem fs = FileSystem.get(new Configuration());
-    Path inpath = new Path("build/examples-test-classes/wdbc");
+    Path inpath = new Path("build/test-classes/wdbc");
     
     DataSet dataset = FileInfoParser.parseFile(fs, inpath);
     DataSet.initialize(dataset);
 
-    String filename = "build/examples-test-classes/wdbc/wdbc.data";
+    String filename = "build/test-classes/wdbc/wdbc.data";
     BufferedReader in = new BufferedReader(new FileReader(filename));
 
     String line;

Modified: lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluatorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluatorTest.java?rev=686745&r1=686744&r2=686745&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluatorTest.java
(original)
+++ lucene/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/hadoop/CDMahoutEvaluatorTest.java
Mon Aug 18 06:11:12 2008
@@ -28,7 +28,7 @@
     }
 
     // dataset
-    Path input = new Path("build/examples-test-classes/wdbc");
+    Path input = new Path("build/test-classes/wdbc");
     CDMahoutEvaluator.InitializeDataSet(input);
 
     // evaluate the rules

Added: lucene/mahout/trunk/examples/src/test/resources/wdbc.infos
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/test/resources/wdbc.infos?rev=686745&view=auto
==============================================================================
--- lucene/mahout/trunk/examples/src/test/resources/wdbc.infos (added)
+++ lucene/mahout/trunk/examples/src/test/resources/wdbc.infos Mon Aug 18 06:11:12 2008
@@ -0,0 +1,32 @@
+IGNORED
+LABEL, B, M
+NUMERICAL, 6.9, 28.2
+NUMERICAL, 9.7, 39.3
+NUMERICAL, 43.7, 188.5
+NUMERICAL, 143.5, 2501.0
+NUMERICAL, 0.0, 0.2
+NUMERICAL, 0.0, 0.4
+NUMERICAL, 0.0, 0.5
+NUMERICAL, 0.0, 0.3
+NUMERICAL, 0.1, 0.4 
+NUMERICAL, 0.0, 0.1
+NUMERICAL, 0.1, 2.9
+NUMERICAL, 0.3, 4.9
+NUMERICAL, 0.7, 22.0
+NUMERICAL, 6.8, 542.3
+NUMERICAL, 0.0, 0.1
+NUMERICAL, 0.0, 0.2
+NUMERICAL, 0.0, 0.4
+NUMERICAL, 0.0, 0.1
+NUMERICAL, 0.0, 0.1
+NUMERICAL, 0.0, 0.1
+NUMERICAL, 7.9, 36.1
+NUMERICAL, 12.0, 49.6
+NUMERICAL, 50.4, 251.2
+NUMERICAL, 185.2, 4254.0
+NUMERICAL, 0.0, 0.3
+NUMERICAL, 0.0, 1.1
+NUMERICAL, 0.0, 1.3
+NUMERICAL, 0.0, 0.3
+NUMERICAL, 0.1, 0.7
+NUMERICAL, 0.0, 0.3 



Mime
View raw message