mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1229032 - in /mahout/trunk: core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/knn/ core/src/main/java/org/apache/mahout/classifier/ core/src/main/java/org/apache/mahout...
Date Mon, 09 Jan 2012 05:27:29 GMT
Author: srowen
Date: Mon Jan  9 05:27:28 2012
New Revision: 1229032

URL: http://svn.apache.org/viewvc?rev=1229032&view=rev
Log:
More of my suggested refinements

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ALSUtils.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/knn/KnnItemBasedRecommender.java
    mahout/trunk/core/src/main/java/org/apache/mahout/classifier/RegressionResultAnalyzer.java
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/cvb/TopicModel.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/AbstractJob.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/ClassUtils.java
    mahout/trunk/core/src/main/java/org/apache/mahout/ep/State.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/DistributedRowMatrixWriter.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
    mahout/trunk/core/src/test/java/org/apache/mahout/classifier/df/data/Utils.java
    mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineBaseTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/topdown/postprocessor/ClusterOutputPostProcessorTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stats/BasicStatsTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/SSVDTestsHelper.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/ssvd/SequentialOutOfCoreSvdTest.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/df/mapreduce/BuildForest.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/NewsgroupHelper.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/ClustersFilter.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/DescriptionUtils.java
    mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDCrossoverTest.java
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/MatrixDumper.java
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInput.java
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/utils/SplitInputTest.java
    mahout/trunk/integration/src/test/java/org/apache/mahout/utils/vectors/VectorHelperTest.java
    mahout/trunk/math/src/main/java/org/apache/mahout/math/CholeskyDecomposition.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/ssvd/SequentialBigSvdTest.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ALSUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ALSUtils.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ALSUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ALSUtils.java Mon Jan  9 05:27:28 2012
@@ -32,7 +32,7 @@ import org.apache.mahout.math.map.OpenIn
 import java.io.IOException;
 import java.util.Iterator;
 
-public final class ALSUtils {
+final class ALSUtils {
 
   private ALSUtils() {}
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/knn/KnnItemBasedRecommender.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/knn/KnnItemBasedRecommender.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/knn/KnnItemBasedRecommender.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/recommender/knn/KnnItemBasedRecommender.java Mon Jan  9 05:27:28 2012
@@ -18,6 +18,7 @@
 package org.apache.mahout.cf.taste.impl.recommender.knn;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.mahout.cf.taste.common.TasteException;
@@ -76,7 +77,7 @@ public final class KnnItemBasedRecommend
   
   private double[] getInterpolations(long itemID, 
                                      long[] itemNeighborhood,
-                                     List<Long> usersRatedNeighborhood) throws TasteException {
+                                     Collection<Long> usersRatedNeighborhood) throws TasteException {
     
     int length = 0;
     for (int i = 0; i < itemNeighborhood.length; i++) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/RegressionResultAnalyzer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/RegressionResultAnalyzer.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/RegressionResultAnalyzer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/RegressionResultAnalyzer.java Mon Jan  9 05:27:28 2012
@@ -30,12 +30,18 @@ import org.apache.commons.lang.StringUti
 public class RegressionResultAnalyzer {
 
   private static class Result {
-    final double actual;
-    final double result;
+    private final double actual;
+    private final double result;
     Result(double actual, double result) {
       this.actual = actual;
       this.result = result;
     }
+    double getActual() {
+      return actual;
+    }
+    double getResult() {
+      return result;
+    }
   }
   
   private List<Result> results;
@@ -75,11 +81,13 @@ public class RegressionResultAnalyzer {
     double sumAbsoluteSquared = 0.0;
 
     for (Result res : results) {
-      sumActual += res.actual;
-      sumActualSquared += res.actual * res.actual;
-      sumResult += res.result;
-      sumResultSquared += res.result * res.result;
-      double absolute = Math.abs(res.actual - res.result);
+      double actual = res.getActual();
+      double result = res.getResult();
+      sumActual += actual;
+      sumActualSquared += actual * actual;
+      sumResult += result;
+      sumResultSquared += result * result;
+      double absolute = Math.abs(actual - result);
       sumAbsolute += absolute;
       sumAbsoluteSquared += absolute * absolute;
     }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/cvb/TopicModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/cvb/TopicModel.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/cvb/TopicModel.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/cvb/TopicModel.java Mon Jan  9 05:27:28 2012
@@ -456,7 +456,7 @@ public class TopicModel implements Confi
         synchronized (this) {
           while(!shutdownComplete) {
             shutdown = true;
-            wait();
+            wait(10000L); // Arbitrarily, wait 10 seconds rather than forever for this
           }
         }
       } catch (InterruptedException e) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/AbstractJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/AbstractJob.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/AbstractJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/AbstractJob.java Mon Jan  9 05:27:28 2012
@@ -103,7 +103,7 @@ public abstract class AbstractJob extend
 
   /** internal list of options that have been added */
   private final List<Option> options;
-  protected Group group;
+  private Group group;
 
   protected AbstractJob() {
     options = new LinkedList<Option>();
@@ -195,6 +195,10 @@ public abstract class AbstractJob extend
     return option;
   }
 
+  protected Group getGroup() {
+    return group;
+  }
+
   /** Add the default input directory option, '-i' which takes a directory
    *  name as an argument. When {@link #parseArguments(String[])} is 
    *  called, the inputPath will be set based upon the value for this option.

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/ClassUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/ClassUtils.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/ClassUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/ClassUtils.java Mon Jan  9 05:27:28 2012
@@ -31,7 +31,7 @@ public final class ClassUtils {
     }
   }
 
-  public static <T> T instantiateAs(String classname, Class<T> asSubclassOfClass, Class[] params, Object[] args) {
+  public static <T> T instantiateAs(String classname, Class<T> asSubclassOfClass, Class<?>[] params, Object[] args) {
     try {
       return instantiateAs(Class.forName(classname).asSubclass(asSubclassOfClass), asSubclassOfClass, params, args);
     } catch (ClassNotFoundException e) {
@@ -39,7 +39,10 @@ public final class ClassUtils {
     }
   }
 
-  public static <T> T instantiateAs(Class<? extends T> clazz, Class<T> asSubclassOfClass, Class[] params, Object[] args) {
+  public static <T> T instantiateAs(Class<? extends T> clazz,
+                                    Class<T> asSubclassOfClass,
+                                    Class<?>[] params,
+                                    Object[] args) {
     try {
       return clazz.asSubclass(asSubclassOfClass).getConstructor(params).newInstance(args);
     } catch (InstantiationException ie) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ep/State.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ep/State.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ep/State.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ep/State.java Mon Jan  9 05:27:28 2012
@@ -66,7 +66,7 @@ public class State<T extends Payload<U>,
   private double[] step;
   // current fitness value
   private double value;
-  private Payload<U> payload;
+  private T payload;
 
   public State() {
   }
@@ -91,7 +91,7 @@ public class State<T extends Payload<U>,
     r.step = Arrays.copyOf(this.step, this.step.length);
     r.maps = Arrays.copyOf(this.maps, this.maps.length);
     if (this.payload != null) {
-      r.payload = this.payload.copy();
+      r.payload = (T) this.payload.copy();
     }
     r.gen = this.gen;
     return r;
@@ -177,7 +177,7 @@ public class State<T extends Payload<U>,
   }
 
   public T getPayload() {
-    return (T) payload;
+    return payload;
   }
 
   public double getValue() {
@@ -297,6 +297,6 @@ public class State<T extends Payload<U>,
       step[i] = input.readDouble();
     }
     value = input.readDouble();
-    payload = PolymorphicWritable.read(input, Payload.class);
+    payload = (T) PolymorphicWritable.read(input, Payload.class);
   }
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/DistributedRowMatrixWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/DistributedRowMatrixWriter.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/DistributedRowMatrixWriter.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/DistributedRowMatrixWriter.java Mon Jan  9 05:27:28 2012
@@ -29,8 +29,7 @@ public final class DistributedRowMatrixW
   private DistributedRowMatrixWriter() {
   }
 
-  public static void write(Path outputDir, Configuration conf, VectorIterable matrix)
-      throws IOException {
+  public static void write(Path outputDir, Configuration conf, Iterable<MatrixSlice> matrix) throws IOException {
     FileSystem fs = outputDir.getFileSystem(conf);
     SequenceFile.Writer writer = SequenceFile.createWriter(fs, conf, outputDir,
         IntWritable.class, VectorWritable.class);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java Mon Jan  9 05:27:28 2012
@@ -196,10 +196,18 @@ public final class TimesSquaredJob {
   public static class TimesSquaredMapper<T extends WritableComparable> extends MapReduceBase
       implements Mapper<T,VectorWritable, NullWritable,VectorWritable> {
 
-    Vector outputVector;
-    OutputCollector<NullWritable,VectorWritable> out;
+    private Vector outputVector;
+    private OutputCollector<NullWritable,VectorWritable> out;
     private Vector inputVector;
 
+    Vector getOutputVector() {
+      return outputVector;
+    }
+    
+    void setOut(OutputCollector<NullWritable,VectorWritable> out) {
+      this.out = out;
+    }
+
     @Override
     public void configure(JobConf conf) {
       try {
@@ -230,7 +238,7 @@ public final class TimesSquaredJob {
                     VectorWritable v,
                     OutputCollector<NullWritable,VectorWritable> out,
                     Reporter rep) throws IOException {
-      this.out = out;
+      setOut(out);
       double d = scale(v);
       if (d == 1.0) {
         outputVector.assign(v.get(), Functions.PLUS);
@@ -258,10 +266,10 @@ public final class TimesSquaredJob {
                     VectorWritable v,
                     OutputCollector<NullWritable,VectorWritable> out,
                     Reporter rep) {
-      this.out = out;
+      setOut(out);
       double d = scale(v);
       if (d != 0.0) {
-        outputVector.setQuick(rowNum.get(), d);
+        getOutputVector().setQuick(rowNum.get(), d);
       }
     }
   }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/classifier/df/data/Utils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/df/data/Utils.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/classifier/df/data/Utils.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/classifier/df/data/Utils.java Mon Jan  9 05:27:28 2012
@@ -226,15 +226,15 @@ public final class Utils {
 
   /**
    * Generates random data with same label value
-   * 
-   * @param rng
-   * @param descriptor
-   * @param regression
+   *
    * @param number data size
    * @param value label value
    */
   public static double[][] randomDoublesWithSameLabel(Random rng,
-      String descriptor, boolean regression, int number, int value) throws DescriptorException {
+                                                      CharSequence descriptor,
+                                                      boolean regression,
+                                                      int number,
+                                                      int value) throws DescriptorException {
     int label = findLabel(descriptor);
     
     double[][] source = randomDoubles(rng, descriptor, regression, number);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineBaseTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineBaseTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineBaseTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/OnlineBaseTest.java Mon Jan  9 05:27:28 2012
@@ -44,11 +44,11 @@ public abstract class OnlineBaseTest ext
 
   private Matrix input;
 
-  protected Matrix getInput() {
+  Matrix getInput() {
     return input;
   }
 
-  protected Vector readStandardData() throws IOException {
+  Vector readStandardData() throws IOException {
     // 60 test samples.  First column is constant.  Second and third are normally distributed from
     // either N([2,2], 1) (rows 0...29) or N([-2,-2], 1) (rows 30...59).  The first 30 rows have a
     // target variable of 0, the last 30 a target of 1.  The remaining columns are are random noise.
@@ -61,7 +61,7 @@ public abstract class OnlineBaseTest ext
     return target;
   }
 
-  protected static void train(Matrix input, Vector target, OnlineLearner lr) {
+  static void train(Matrix input, Vector target, OnlineLearner lr) {
     RandomUtils.useTestSeed();
     Random gen = RandomUtils.getRandom();
 
@@ -72,8 +72,8 @@ public abstract class OnlineBaseTest ext
     lr.close();
   }
 
-  protected static void test(Matrix input, Vector target, AbstractVectorClassifier lr,
-                             double expected_mean_error, double expected_absolute_error) {
+  static void test(Matrix input, Vector target, AbstractVectorClassifier lr,
+                   double expected_mean_error, double expected_absolute_error) {
     // now test the accuracy
     Matrix tmp = lr.classify(input);
     // mean(abs(tmp - target))
@@ -100,7 +100,7 @@ public abstract class OnlineBaseTest ext
    * @param max The number of integers to permute
    * @return An array of jumbled integer values
    */
-  protected static int[] permute(Random gen, int max) {
+  static int[] permute(Random gen, int max) {
     int[] permutation = new int[max];
     permutation[0] = 0;
     for (int i = 1; i < max; i++) {
@@ -125,7 +125,7 @@ public abstract class OnlineBaseTest ext
    * @return A matrix of the results.
    * @throws IOException If there is an error reading the data
    */
-  protected static Matrix readCsv(String resourceName) throws IOException {
+  static Matrix readCsv(String resourceName) throws IOException {
     Splitter onCommas = Splitter.on(',').trimResults(CharMatcher.anyOf(" \""));
 
     Readable isr = new InputStreamReader(Resources.getResource(resourceName).openStream(), Charsets.UTF_8);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/topdown/postprocessor/ClusterOutputPostProcessorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/topdown/postprocessor/ClusterOutputPostProcessorTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/topdown/postprocessor/ClusterOutputPostProcessorTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/topdown/postprocessor/ClusterOutputPostProcessorTest.java Mon Jan  9 05:27:28 2012
@@ -53,9 +53,9 @@ import org.junit.Test;
 
 import com.google.common.collect.Lists;
 
-public class ClusterOutputPostProcessorTest extends MahoutTestCase {
+public final class ClusterOutputPostProcessorTest extends MahoutTestCase {
   
-  public static final double[][] REFERENCE = { {1, 1}, {2, 1}, {1, 2}, {4, 4}, {5, 4}, {4, 5}, {5, 5}};
+  private static final double[][] REFERENCE = { {1, 1}, {2, 1}, {1, 2}, {4, 4}, {5, 4}, {4, 5}, {5, 5}};
   
   private FileSystem fs;
   
@@ -71,7 +71,7 @@ public class ClusterOutputPostProcessorT
     fs = FileSystem.get(conf);
   }
   
-  public static List<VectorWritable> getPointsWritable(double[][] raw) {
+  private static List<VectorWritable> getPointsWritable(double[][] raw) {
     List<VectorWritable> points = Lists.newArrayList();
     for (double[] fr : raw) {
       Vector vec = new RandomAccessSparseVector(fr.length);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stats/BasicStatsTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stats/BasicStatsTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stats/BasicStatsTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stats/BasicStatsTest.java Mon Jan  9 05:27:28 2012
@@ -24,10 +24,10 @@ import org.apache.hadoop.io.DoubleWritab
 import org.apache.hadoop.io.IntWritable;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.mahout.common.MahoutTestCase;
+import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.math.jet.random.Normal;
 import org.junit.Before;
 import org.junit.Test;
-import org.uncommons.maths.random.MersenneTwisterRNG;
 
 import java.util.Random;
 
@@ -108,7 +108,7 @@ public final class BasicStatsTest extend
     FileSystem fs = FileSystem.get(conf);
     SequenceFile.Writer writer = new SequenceFile.Writer(fs, conf, input, IntWritable.class,
             DoubleWritable.class);
-    Random random = new MersenneTwisterRNG();
+    Random random = RandomUtils.getRandom();
     Normal normal = new Normal(5, 3, random);
     for (int i = 0; i < 1000000; i++) {
       writer.append(new IntWritable(i), new DoubleWritable((long) normal.nextInt()));

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/SSVDTestsHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/SSVDTestsHelper.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/SSVDTestsHelper.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/SSVDTestsHelper.java Mon Jan  9 05:27:28 2012
@@ -134,7 +134,7 @@ public class SSVDTestsHelper {
      */
     
     outputDir = new Path("/tmp/DRM-sparse");
-    Random rnd = new Random();
+    Random rnd = RandomUtils.getRandom();
 
     SequenceFile.Writer w =
       SequenceFile.createWriter(dfs,

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/ssvd/SequentialOutOfCoreSvdTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/ssvd/SequentialOutOfCoreSvdTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/ssvd/SequentialOutOfCoreSvdTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/ssvd/SequentialOutOfCoreSvdTest.java Mon Jan  9 05:27:28 2012
@@ -85,7 +85,7 @@ public final class SequentialOutOfCoreSv
     })));
 
     // The values in A are pretty big so this is a pretty tight relative tolerance
-    assertEquals(0, A.minus(u.times(new DiagonalMatrix(s.getSingularValues())).times(v.transpose())).aggregate(Functions.PLUS, Functions.ABS), 1e-7);
+    assertEquals(0, A.minus(u.times(new DiagonalMatrix(s.getSingularValues())).times(v.transpose())).aggregate(Functions.PLUS, Functions.ABS), 1.0e-7);
   }
 
   private static Matrix readBlockMatrix(List<File> files) throws IOException {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/df/mapreduce/BuildForest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/df/mapreduce/BuildForest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/df/mapreduce/BuildForest.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/df/mapreduce/BuildForest.java Mon Jan  9 05:27:28 2012
@@ -191,8 +191,7 @@ public class BuildForest extends Configu
     return 0;
   }
   
-  private void buildForest() throws IOException, ClassNotFoundException, InterruptedException,
-    InstantiationException, IllegalAccessException {
+  private void buildForest() throws IOException, ClassNotFoundException, InterruptedException {
     // make sure the output path does not exist
     FileSystem ofs = outputPath.getFileSystem(getConf());
     if (ofs.exists(outputPath)) {

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/NewsgroupHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/NewsgroupHelper.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/NewsgroupHelper.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/NewsgroupHelper.java Mon Jan  9 05:27:28 2012
@@ -113,8 +113,10 @@ final class NewsgroupHelper {
     return v;
   }
 
-  static void countWords(Analyzer analyzer, Collection<String> words, Reader in, Multiset<String> overallCounts) 
-    throws IOException {
+  private static void countWords(Analyzer analyzer,
+                                 Collection<String> words,
+                                 Reader in,
+                                 Multiset<String> overallCounts) throws IOException {
     TokenStream ts = analyzer.reusableTokenStream("text", in);
     ts.addAttribute(CharTermAttribute.class);
     ts.reset();

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/ClustersFilter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/ClustersFilter.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/ClustersFilter.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/ClustersFilter.java Mon Jan  9 05:27:28 2012
@@ -21,10 +21,12 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.PathFilter;
 import org.apache.mahout.clustering.Cluster;
 
-public class ClustersFilter implements PathFilter {
+final class ClustersFilter implements PathFilter {
+
   @Override
   public boolean accept(Path path) {
     String pathString = path.toString();
     return pathString.contains("/clusters-") && pathString.endsWith(Cluster.FINAL_ITERATION_SUFFIX);
   }
+
 }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayClustering.java Mon Jan  9 05:27:28 2012
@@ -206,7 +206,7 @@ public class DisplayClustering extends F
          : new SequenceFileIterable<IntWritable, WeightedVectorWritable>(inputPath, new Configuration())) {
     	int clusterId = record.getFirst().get();
     	VectorWritable v = SAMPLE_DATA.get(point++);
-    	Integer key = new Integer(clusterId);
+    	Integer key = clusterId;
     	if (!colors.containsKey(key)){
     		colors.put(key, COLORS[Math.min(COLORS.length - 1, colors.size())]);
     	}

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/DescriptionUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/DescriptionUtils.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/DescriptionUtils.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/DescriptionUtils.java Mon Jan  9 05:27:28 2012
@@ -24,7 +24,7 @@ import java.util.regex.Pattern;
 /**
  * Utility functions to handle Attribute's description strings.
  */
-public final class DescriptionUtils {
+final class DescriptionUtils {
 
   private static final Pattern COMMA = Pattern.compile(",");
 
@@ -33,20 +33,15 @@ public final class DescriptionUtils {
 
   /**
    * Create a numerical attribute description.
-   * 
-   * @param min
-   * @param max
    */
-  public static String createNumericalDescription(double min, double max) {
+  static String createNumericalDescription(double min, double max) {
     return min + "," + max;
   }
   
   /**
    * Create a nominal description from the possible values.
-   * 
-   * @param values
    */
-  public static String createNominalDescription(Collection<String> values) {
+  static String createNominalDescription(Collection<String> values) {
     StringBuilder buffer = new StringBuilder();
     int ind = 0;
     
@@ -60,7 +55,7 @@ public final class DescriptionUtils {
     return buffer.toString();
   }
   
-  public static double[] extractNumericalRange(CharSequence description) {
+  static double[] extractNumericalRange(CharSequence description) {
     String[] tokens = COMMA.split(description);
     double min = Double.parseDouble(tokens[0]);
     double max = Double.parseDouble(tokens[1]);
@@ -69,12 +64,10 @@ public final class DescriptionUtils {
   /**
    * Extract all available values from the description.
    * 
-   * @param description
    * @param target the extracted values will be added to this collection. It
    *        will not be cleared.
    */
-  public static void extractNominalValues(CharSequence description,
-                                          Collection<String> target) {
+  static void extractNominalValues(CharSequence description, Collection<String> target) {
     Collections.addAll(target, COMMA.split(description));
   }
   

Modified: mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDCrossoverTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDCrossoverTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDCrossoverTest.java (original)
+++ mahout/trunk/examples/src/test/java/org/apache/mahout/ga/watchmaker/cd/CDCrossoverTest.java Mon Jan  9 05:27:28 2012
@@ -131,7 +131,7 @@ public final class CDCrossoverTest exten
 
   }
 
-  static int countAreas(CDRule rule) {
+  private static int countAreas(CDRule rule) {
 
     int nbareas = 1; // we already start in an area
     int partind = 0; // index of the start of the current part
@@ -147,7 +147,7 @@ public final class CDCrossoverTest exten
     return nbareas;
   }
 
-  static CDRule generate0Rule() {
+  private static CDRule generate0Rule() {
     CDRule rule = new CDRule(1);
 
     for (int index = 0; index < rule.getNbConditions(); index++) {
@@ -159,7 +159,7 @@ public final class CDCrossoverTest exten
     return rule;
   }
 
-  static CDRule generate1Rule() {
+  private static CDRule generate1Rule() {
     CDRule rule = new CDRule(1);
 
     for (int index = 0; index < rule.getNbConditions(); index++) {

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/MatrixDumper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/MatrixDumper.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/MatrixDumper.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/MatrixDumper.java Mon Jan  9 05:27:28 2012
@@ -25,12 +25,10 @@ import java.io.PrintStream;
 import java.util.Map;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.SequenceFile;
-import org.apache.hadoop.io.Text;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.mahout.common.AbstractJob;
+import org.apache.mahout.common.iterator.sequencefile.SequenceFileValueIterator;
 import org.apache.mahout.math.Matrix;
 import org.apache.mahout.math.MatrixWritable;
 
@@ -67,11 +65,11 @@ public final class MatrixDumper extends 
   }
   
   private static void exportCSV(Path inputPath, String outputFile, boolean doLabels) throws IOException {
-    MatrixWritable mw = new MatrixWritable();
-    Text key = new Text();
-    readSeqFile(inputPath, key, mw);
+    SequenceFileValueIterator<MatrixWritable> it =
+        new SequenceFileValueIterator<MatrixWritable>(inputPath, true, new Configuration());
+    Matrix m = it.next().get();
+    it.close();
     PrintStream ps = getPrintStream(outputFile);
-    Matrix m = mw.get();
     String[] columnLabels = getLabels(m.numCols(), m.getColumnLabelBindings(), "col");
     String[] rowLabels = getLabels(m.numRows(), m.getRowLabelBindings(), "row");
     if (doLabels) {
@@ -98,14 +96,6 @@ public final class MatrixDumper extends 
     }
   }
   
-  private static void readSeqFile(Path inputPath, Text key, MatrixWritable m) throws IOException {
-    Configuration conf = new Configuration();
-    FileSystem fs = FileSystem.get(conf);
-    SequenceFile.Reader reader = new SequenceFile.Reader(fs, inputPath, conf);
-    reader.getMetadata();
-    reader.next(key, m);
-  }
-  
   private static PrintStream getPrintStream(String outputPath) throws IOException {
     if (outputPath != null) {
       File outputFile = new File(outputPath);
@@ -128,13 +118,12 @@ public final class MatrixDumper extends 
   private static String[] getLabels(int length, Map<String,Integer> labels, String start) {
     if (labels != null) {
       return sortLabels(labels);
-    } else {
-      String[] sorted = new String[length];
-      for(int i = 1; i <= length; i++) {
-        sorted[i] = start + i;
-      }
-      return sorted;
     }
+    String[] sorted = new String[length];
+    for(int i = 1; i <= length; i++) {
+      sorted[i] = start + i;
+    }
+    return sorted;
   }
   
   private static String[] sortLabels(Map<String,Integer> labels) {

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInput.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInput.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInput.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/SplitInput.java Mon Jan  9 05:27:28 2012
@@ -141,9 +141,6 @@ public class SplitInput extends Abstract
     ToolRunner.run(new Configuration(), new SplitInput(), args);
   }
 
-  public SplitInput() {
-  }
-
   /**
    * Configure this instance based on the command-line arguments contained within provided array.
    * Calls {@link #validate()} to ensure consistency of configuration.
@@ -252,7 +249,7 @@ public class SplitInput extends Abstract
 
     } catch (OptionException e) {
       log.error("Command-line option Exception", e);
-      CommandLineUtil.printHelp(group);
+      CommandLineUtil.printHelp(getGroup());
       return false;
     }
 

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/VectorHelper.java Mon Jan  9 05:27:28 2012
@@ -39,6 +39,7 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
@@ -62,14 +63,12 @@ public final class VectorHelper {
   }
 
   public static String buildJson(Iterable<Pair<String,Double>> iterable, StringBuilder bldr) {
-    bldr.append("{");
-    Iterator<Pair<String, Double>> listIt = iterable.iterator();
-    while(listIt.hasNext()) {
-      Pair<String,Double> p = listIt.next();
+    bldr.append('{');
+    for (Pair<String,Double> p : iterable) {
       bldr.append(p.getFirst());
-      bldr.append(":");
+      bldr.append(':');
       bldr.append(p.getSecond());
-      bldr.append(",");
+      bldr.append(',');
     }
     if(bldr.length() > 1) {
       bldr.setCharAt(bldr.length() - 1, '}');
@@ -89,7 +88,7 @@ public final class VectorHelper {
       queue.insertWithOverflow(Pair.of(e.index(), e.get()));
     }
     List<Pair<Integer, Double>> entries = Lists.newArrayList();
-    Pair<Integer, Double> pair = null;
+    Pair<Integer, Double> pair;
     while((pair = queue.pop()) != null) {
       if(pair.getFirst() > -1) {
         entries.add(pair);
@@ -110,7 +109,7 @@ public final class VectorHelper {
     return entries;
   }
 
-  public static List<Pair<String, Double>> toWeightedTerms(List<Pair<Integer, Double>> entries,
+  public static List<Pair<String, Double>> toWeightedTerms(Collection<Pair<Integer, Double>> entries,
       final String[] dictionary) {
     return Lists.newArrayList(Collections2.transform(entries,
           new Function<Pair<Integer, Double>, Pair<String, Double>>() {
@@ -121,8 +120,7 @@ public final class VectorHelper {
           }));
   }
 
-  public static String vectorToJson(Vector vector, final String[] dictionary, int maxEntries,
-      boolean sort) {
+  public static String vectorToJson(Vector vector, String[] dictionary, int maxEntries, boolean sort) {
     return buildJson(toWeightedTerms(sort
                                      ? topEntries(vector, maxEntries)
                                      : firstEntries(vector, maxEntries), dictionary));
@@ -209,8 +207,8 @@ public final class VectorHelper {
   }
 
   private static class TDoublePQ<T> extends PriorityQueue<Pair<T, Double>> {
-    final T sentinel;
-    public TDoublePQ(T sentinel, int size) {
+    private final T sentinel;
+    private TDoublePQ(T sentinel, int size) {
       initialize(size);
       this.sentinel = sentinel;
     }

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/utils/SplitInputTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/utils/SplitInputTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/utils/SplitInputTest.java (original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/utils/SplitInputTest.java Mon Jan  9 05:27:28 2012
@@ -334,8 +334,7 @@ public final class SplitInputTest extend
    * Validate that number of test records and number of training records
    * are consistant with keepPct and randomSelectionPct
    */
-  private void validateSplitInputMapReduce(int numPoints,
-      int randomSelectionPct, int keepPct) throws Exception {
+  private void validateSplitInputMapReduce(int numPoints, int randomSelectionPct, int keepPct) {
     Path testPath = new Path(tempMapRedOutputDirectory, "test-r-00000");
     Path trainingPath = new Path(tempMapRedOutputDirectory, "training-r-00000");
     int numberTestRecords = getNumberRecords(testPath);

Modified: mahout/trunk/integration/src/test/java/org/apache/mahout/utils/vectors/VectorHelperTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/test/java/org/apache/mahout/utils/vectors/VectorHelperTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/integration/src/test/java/org/apache/mahout/utils/vectors/VectorHelperTest.java (original)
+++ mahout/trunk/integration/src/test/java/org/apache/mahout/utils/vectors/VectorHelperTest.java Mon Jan  9 05:27:28 2012
@@ -1,11 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.apache.mahout.utils.vectors;
 
-import junit.framework.TestCase;
 import org.apache.mahout.math.SequentialAccessSparseVector;
 import org.apache.mahout.math.Vector;
+import org.apache.mahout.utils.MahoutTestCase;
+import org.junit.Test;
 
-public class VectorHelperTest extends TestCase {
+public final class VectorHelperTest extends MahoutTestCase {
 
+  @Test
   public void testJsonFormatting() throws Exception {
     Vector v = new SequentialAccessSparseVector(10);
     v.set(2, 3.1);

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/CholeskyDecomposition.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/CholeskyDecomposition.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/CholeskyDecomposition.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/CholeskyDecomposition.java Mon Jan  9 05:27:28 2012
@@ -70,7 +70,7 @@ public class CholeskyDecomposition {
       L.swap(k, pivot);
 
       double akk = L.get(k, k);
-      double epsilon = 1e-10 * Math.max(uberMax, L.viewColumn(k).aggregate(Functions.MAX, Functions.ABS));
+      double epsilon = 1.0e-10 * Math.max(uberMax, L.viewColumn(k).aggregate(Functions.MAX, Functions.ABS));
 
       if (akk < -epsilon) {
         // can't have decidedly negative element on diagonal
@@ -110,7 +110,7 @@ public class CholeskyDecomposition {
       // set upper part of column to 0.
       L.viewColumn(k).viewPart(0, k).assign(0);
 
-      double epsilon = 1e-10 * L.viewColumn(k).aggregate(Functions.MAX, Functions.ABS);
+      double epsilon = 1.0e-10 * L.viewColumn(k).aggregate(Functions.MAX, Functions.ABS);
       if (akk <= epsilon) {
         // degenerate column case.  Set diagonal to 1, all others to zero
         L.viewColumn(k).viewPart(k, n - k).assign(0);
@@ -206,7 +206,7 @@ public class CholeskyDecomposition {
           int i = L.rowUnpivot(internalI);
           x.set(j, k, x.get(j, k) - x.get(j, i) * L.get(k, i));
           if (Double.isInfinite(x.get(j, k)) || Double.isNaN(x.get(j, k))) {
-            throw new InvalidCholeskyState(j, k);
+            throw new IllegalStateException(String.format("Invalid value found at %d,%d (should not be possible)", j, k));
           }
         }
         if (L.get(k, k) != 0) {
@@ -215,17 +215,12 @@ public class CholeskyDecomposition {
           x.set(j, k, 0);
         }
         if (Double.isInfinite(x.get(j, k)) || Double.isNaN(x.get(j, k))) {
-          throw new InvalidCholeskyState(j, k);
+          throw new IllegalStateException(String.format("Invalid value found at %d,%d (should not be possible)", j, k));
         }
       }
     }
     return x;
   }
 
-  private class InvalidCholeskyState extends RuntimeException {
-    public InvalidCholeskyState(int j, int k) {
-      super(String.format("Invalid value found at %d,%d (should not be possible)", j, k));
-    }
-  }
 }
 

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/QRDecompositionTest.java Mon Jan  9 05:27:28 2012
@@ -36,7 +36,7 @@ public final class QRDecompositionTest e
       public double apply(double arg1, double arg2) {
         return Math.abs(arg1) - Math.abs(arg2);
       }
-    }), 1e-5);
+    }), 1.0e-5);
   }
 
   @Test

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=1229032&r1=1229031&r2=1229032&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 Mon Jan  9 05:27:28 2012
@@ -154,6 +154,7 @@ public abstract class SolverTest extends
 
   public static Matrix randomHierarchicalMatrix(int numRows, int numCols, boolean symmetric) {
     Matrix matrix = new DenseMatrix(numRows, numCols);
+    // TODO rejigger tests so that it doesn't expect this particular seed
     Random r = new Random(1234L);
     for(int row = 0; row < numRows; row++) {
       Vector v = new DenseVector(numCols);

Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/ssvd/SequentialBigSvdTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/ssvd/SequentialBigSvdTest.java?rev=1229032&r1=1229031&r2=1229032&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/ssvd/SequentialBigSvdTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/ssvd/SequentialBigSvdTest.java Mon Jan  9 05:27:28 2012
@@ -17,7 +17,6 @@
 
 package org.apache.mahout.math.ssvd;
 
-import org.apache.mahout.math.DenseMatrix;
 import org.apache.mahout.math.DenseVector;
 import org.apache.mahout.math.DiagonalMatrix;
 import org.apache.mahout.math.MahoutTestCase;
@@ -28,7 +27,8 @@ import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.function.Functions;
 import org.junit.Test;
 
-public class SequentialBigSvdTest extends MahoutTestCase {
+public final class SequentialBigSvdTest extends MahoutTestCase {
+
   @Test
   public void testSingularValues() {
     Matrix A = lowRankMatrix();
@@ -53,15 +53,15 @@ public class SequentialBigSvdTest extend
     // go to zero, the singular vectors are not uniquely determined
     Matrix u1 = svd.getU().viewPart(0, 20, 0, 4).assign(Functions.ABS);
     Matrix u2 = s.getU().viewPart(0, 20, 0, 4).assign(Functions.ABS);
-    assertEquals(0, u1.minus(u2).aggregate(Functions.PLUS, Functions.ABS), 1e-9);
+    assertEquals(0, u1.minus(u2).aggregate(Functions.PLUS, Functions.ABS), 1.0e-9);
   }
 
-  private void assertEquals(Matrix u1, Matrix u2) {
-    assertEquals(0, u1.minus(u2).aggregate(Functions.MAX, Functions.ABS), 1e-10);
+  private static void assertEquals(Matrix u1, Matrix u2) {
+    assertEquals(0, u1.minus(u2).aggregate(Functions.MAX, Functions.ABS), 1.0e-10);
   }
 
-  private void assertEquals(Vector u1, Vector u2) {
-    assertEquals(0, u1.minus(u2).aggregate(Functions.MAX, Functions.ABS), 1e-10);
+  private static void assertEquals(Vector u1, Vector u2) {
+    assertEquals(0, u1.minus(u2).aggregate(Functions.MAX, Functions.ABS), 1.0e-10);
   }
 
   @Test
@@ -76,7 +76,7 @@ public class SequentialBigSvdTest extend
     assertEquals(v1, v2);
   }
 
-  private Matrix lowRankMatrix() {
+  private static Matrix lowRankMatrix() {
     Matrix u = new RandomTrinaryMatrix(1, 20, 4, false);
     Matrix d = new DiagonalMatrix(new double[]{5, 3, 1, 0.5});
     Matrix v = new RandomTrinaryMatrix(2, 23, 4, false);



Mime
View raw message