You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2010/09/26 18:23:25 UTC

svn commit: r1001469 - in /mahout/trunk: core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java

Author: srowen
Date: Sun Sep 26 16:23:25 2010
New Revision: 1001469

URL: http://svn.apache.org/viewvc?rev=1001469&view=rev
Log:
Fix breakage, test depended on old particular sequence of random numbers

Modified:
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java?rev=1001469&r1=1001468&r2=1001469&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java Sun Sep 26 16:23:25 2010
@@ -17,10 +17,6 @@
 
 package org.apache.mahout.math.hadoop.decomposer;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -35,7 +31,6 @@ import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.VectorWritable;
 import org.apache.mahout.math.hadoop.DistributedRowMatrix;
 import org.apache.mahout.math.hadoop.TestDistributedRowMatrix;
-import org.apache.mahout.math.hadoop.decomposer.DistributedLanczosSolver.DistributedLanczosSolverJob;
 import org.junit.Test;
 
 public final class TestDistributedLanczosSolverCLI extends MahoutTestCase {
@@ -43,13 +38,19 @@ public final class TestDistributedLanczo
   @Test
   public void testDistributedLanczosSolverCLI() throws Exception {
     Path testData = getTestTempDirPath("testdata");
-    DistributedRowMatrix corpus = new TestDistributedRowMatrix().randomDistributedMatrix(500, 450, 500, 10, 10.0, true, testData
-        .toString());
+    DistributedRowMatrix corpus =
+        new TestDistributedRowMatrix().randomDistributedMatrix(500, 450, 500, 10, 10.0, true, testData.toString());
     corpus.configure(new JobConf());
     Path output = getTestTempDirPath("output");
     Path tmp = getTestTempDirPath("tmp");
-    String[] args = { "-i", new Path(testData, "distMatrix").toString(), "-o", output.toString(), "--tempDir", tmp.toString(), "--numRows", "500",
-        "--numCols", "500", "--rank", "10", "--symmetric", "true" };
+    String[] args = {
+        "-i", new Path(testData, "distMatrix").toString(),
+        "-o", output.toString(),
+        "--tempDir", tmp.toString(), "--numRows", "500",
+        "--numCols", "500",
+        "--rank", "10",
+        "--symmetric", "true"
+    };
     new DistributedLanczosSolver().new DistributedLanczosSolverJob().run(args);
 
     Path rawEigenvectors = new Path(output, DistributedLanczosSolver.RAW_EIGENVECTORS);
@@ -78,13 +79,21 @@ public final class TestDistributedLanczo
   @Test
   public void testDistributedLanczosSolverEVJCLI() throws Exception {
     Path testData = getTestTempDirPath("testdata");
-    DistributedRowMatrix corpus = new TestDistributedRowMatrix().randomDistributedMatrix(500, 450, 500, 10, 10.0, true, testData
-        .toString());
+    DistributedRowMatrix corpus =
+        new TestDistributedRowMatrix().randomDistributedMatrix(500, 450, 500, 10, 10.0, true, testData.toString());
     corpus.configure(new JobConf());
     Path output = getTestTempDirPath("output");
     Path tmp = getTestTempDirPath("tmp");
-    String[] args = { "-i", new Path(testData, "distMatrix").toString(), "-o", output.toString(), "--tempDir", tmp.toString(), "--numRows", "500",
-        "--numCols", "500", "--rank", "10", "--symmetric", "true", "--cleansvd", "true" };
+    String[] args = {
+        "-i", new Path(testData, "distMatrix").toString(),
+        "-o", output.toString(),
+        "--tempDir", tmp.toString(),
+        "--numRows", "500",
+        "--numCols", "500",
+        "--rank", "10",
+        "--symmetric", "true",
+        "--cleansvd", "true"
+    };
     new DistributedLanczosSolver().new DistributedLanczosSolverJob().run(args);
   
     Path cleanEigenvectors = new Path(output, EigenVerificationJob.CLEAN_EIGENVECTORS);

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java?rev=1001469&r1=1001468&r2=1001469&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java Sun Sep 26 16:23:25 2010
@@ -17,7 +17,6 @@
 
 package org.apache.mahout.math.decomposer;
 
-import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.math.MahoutTestCase;
 import org.apache.mahout.math.Matrix;
 import org.apache.mahout.math.SequentialAccessSparseVector;
@@ -84,7 +83,8 @@ public abstract class SolverTest extends
                                                           double entryMean) {
     SparseRowMatrix m = new SparseRowMatrix(new int[]{numRows, numCols});
     //double n = 0;
-    Random r = RandomUtils.getRandom(1234L);
+    // TODO figure out how to redo the test so this can use RandomUtils
+    Random r = new Random(1234L);
     for (int i = 0; i < nonNullRows; i++) {
       SequentialAccessSparseVector v = new SequentialAccessSparseVector(numCols);
       for (int j = 0; j < entriesPerRow; j++) {