mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1003478 [2/3] - in /mahout/trunk: core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/ core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/ core/src/main/java/org/apache/mahout/classifier/ core/src/main/java/org/apache/maho...
Date Fri, 01 Oct 2010 11:00:20 GMT
Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/common/VectorMatrixMultiplicationJob.java Fri Oct  1 11:00:16 2010
@@ -49,15 +49,15 @@ import org.apache.mahout.math.hadoop.Dis
  */
 public final class VectorMatrixMultiplicationJob {
 
+  private VectorMatrixMultiplicationJob() {
+  }
+
   /**
    * Invokes the job.
    * @param markovPath Path to the markov DRM's sequence files
-   * @param diag
-   * @param outputPath
-   * @return
    */
-  public static DistributedRowMatrix runJob(Path markovPath, Vector diag, 
-      Path outputPath) throws IOException, ClassNotFoundException, InterruptedException {
+  public static DistributedRowMatrix runJob(Path markovPath, Vector diag, Path outputPath)
+    throws IOException, ClassNotFoundException, InterruptedException {
     
     // set up the serialization of the diagonal vector
     Configuration conf = new Configuration();

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsAffinityCutsJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsAffinityCutsJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsAffinityCutsJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsAffinityCutsJob.java Fri Oct  1 11:00:16 2010
@@ -34,14 +34,19 @@ import org.apache.mahout.clustering.spec
 import org.apache.mahout.math.RandomAccessSparseVector;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.VectorWritable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-/**
- * TODO: Need a really good description of what this job does...
- *
- */
 public final class EigencutsAffinityCutsJob {
-  
-  static enum CUTSCOUNTER {NUM_CUTS}
+
+  private static final Logger log = LoggerFactory.getLogger(EigencutsAffinityCutsJob.class);
+
+  private EigencutsAffinityCutsJob() {
+  }
+
+  enum CUTSCOUNTER {
+    NUM_CUTS
+  }
 
   /**
    * Runs a single iteration of defining cluster boundaries, based on
@@ -50,14 +55,9 @@ public final class EigencutsAffinityCuts
    * @param currentAffinity Path to the current affinity matrix.
    * @param cutMatrix Path to the sensitivity matrix.
    * @param nextAffinity Output path for the new affinity matrix.
-   * @param conf
-   * @throws IOException
-   * @throws ClassNotFoundException
-   * @throws InterruptedException
    */
-  public static long runjob(Path currentAffinity, Path cutMatrix, Path nextAffinity,
-      Configuration conf) throws IOException, ClassNotFoundException, 
-      InterruptedException {
+  public static long runjob(Path currentAffinity, Path cutMatrix, Path nextAffinity, Configuration conf)
+    throws IOException, ClassNotFoundException, InterruptedException {
     
     // these options allow us to differentiate between the two vectors
     // in the mapper and reducer - we'll know from the working path
@@ -121,12 +121,13 @@ public final class EigencutsAffinityCuts
       // 2) add their former values to the (i, i) and (j, j) coordinates
       //
       // though obviously we want to perform these steps in reverse order
+      Configuration conf = context.getConfiguration();
+      log.debug("{}", t);
       boolean zero = false;
-      int i = -1, j = -1;
+      int i = -1;
+      int j = -1;
       double k = 0;
-      Configuration conf = context.getConfiguration();
       int count = 0;
-      System.out.println("DEBUG: " + t.toString());
       for (VertexWritable v : vertices) {
         count++;
         if (v.getType().equals(conf.get(EigencutsKeys.AFFINITY_PATH))) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsDriver.java Fri Oct  1 11:00:16 2010
@@ -19,6 +19,7 @@ package org.apache.mahout.clustering.spe
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -49,7 +50,7 @@ public class EigencutsDriver extends Abs
 
   public static final double OVERSHOOT_MULTIPLIER = 1.5;
 
-  public static void main(String args[]) throws Exception {
+  public static void main(String[] args) throws Exception {
     ToolRunner.run(new EigencutsDriver(), args);
   }
 
@@ -61,8 +62,8 @@ public class EigencutsDriver extends Abs
     addOption("output", "o", "Output of clusterings", true);
     addOption("half-life", "b", "Minimal half-life threshold", true);
     addOption("dimensions", "d", "Square dimensions of affinity matrix", true);
-    addOption("epsilon", "e", "Half-life threshold coefficient", Double.toString(EigencutsDriver.EPSILON_DEFAULT));
-    addOption("tau", "t", "Threshold for cutting affinities", Double.toString(EigencutsDriver.TAU_DEFAULT));
+    addOption("epsilon", "e", "Half-life threshold coefficient", Double.toString(EPSILON_DEFAULT));
+    addOption("tau", "t", "Threshold for cutting affinities", Double.toString(TAU_DEFAULT));
     addOption(DefaultOptionCreator.overwriteOption().create());
     Map<String, String> parsedArgs = parseArguments(arg0);
     if (parsedArgs == null) {
@@ -95,12 +96,15 @@ public class EigencutsDriver extends Abs
    * @param halflife the double minimum half-life threshold
    * @param epsilon the double coefficient for setting minimum half-life threshold
    * @param tau the double tau threshold for cutting links in the affinity graph
-   * @throws IOException
-   * @throws InterruptedException
-   * @throws ClassNotFoundException
    */
-  public static void run(Configuration conf, Path input, Path output, int dimensions, double halflife, double epsilon, double tau)
-      throws IOException, InterruptedException, ClassNotFoundException {
+  public static void run(Configuration conf,
+                         Path input,
+                         Path output,
+                         int dimensions,
+                         double halflife,
+                         double epsilon,
+                         double tau)
+    throws IOException, InterruptedException, ClassNotFoundException {
     // set the instance variables
     // create a few new Paths for temp files and transformations
     Path outputCalc = new Path(output, "calculations");
@@ -109,19 +113,20 @@ public class EigencutsDriver extends Abs
     DistributedRowMatrix A = AffinityMatrixInputJob.runJob(input, outputCalc, dimensions);
     Vector D = MatrixDiagonalizeJob.runJob(A.getRowPath(), dimensions);
 
-    long numCuts = 0;
+    long numCuts;
     do {
       // first three steps are the same as spectral k-means:
       // 1) calculate D from A
       // 2) calculate L = D^-0.5 * A * D^-0.5
       // 3) calculate eigenvectors of L
 
-      DistributedRowMatrix L = VectorMatrixMultiplicationJob.runJob(A.getRowPath(), D, new Path(outputCalc, "laplacian-"
-          + (System.nanoTime() & 0xFF)));
+      DistributedRowMatrix L =
+          VectorMatrixMultiplicationJob.runJob(A.getRowPath(), D,
+              new Path(outputCalc, "laplacian-" + (System.nanoTime() & 0xFF)));
       L.configure(new JobConf(conf));
 
       // eigendecomposition (step 3)
-      int overshoot = (int) ((double) dimensions * EigencutsDriver.OVERSHOOT_MULTIPLIER);
+      int overshoot = (int) ((double) dimensions * OVERSHOOT_MULTIPLIER);
       List<Double> eigenValues = new ArrayList<Double>(overshoot);
       Matrix eigenVectors = new DenseMatrix(overshoot, dimensions);
       DistributedRowMatrix U = performEigenDecomposition(L, dimensions, overshoot, eigenValues, eigenVectors, outputCalc);
@@ -158,13 +163,6 @@ public class EigencutsDriver extends Abs
    * Does most of the heavy lifting in setting up Paths, configuring return
    * values, and generally performing the tedious administrative tasks involved
    * in an eigen-decomposition and running the verifier
-   * @param input
-   * @param numEigenVectors
-   * @param overshoot
-   * @param eigenValues
-   * @param eigenVectors
-   * @param tmp
-   * @return
    */
   public static DistributedRowMatrix performEigenDecomposition(DistributedRowMatrix input,
                                                                int numEigenVectors,
@@ -212,14 +210,12 @@ public class EigencutsDriver extends Abs
   /**
    * Iteratively loops through the list, converting it to a Vector of double
    * primitives worthy of other Mahout operations
-   * @param list
-   * @return
    */
-  private static Vector listToVector(List<Double> list) {
+  private static Vector listToVector(Collection<Double> list) {
     Vector retval = new DenseVector(list.size());
     int index = 0;
     for (Double d : list) {
-      retval.setQuick(index++, d.doubleValue());
+      retval.setQuick(index++, d);
     }
     return retval;
   }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsKeys.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsKeys.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsKeys.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsKeys.java Fri Oct  1 11:00:16 2010
@@ -22,63 +22,63 @@ package org.apache.mahout.clustering.spe
  */
 public interface EigencutsKeys {
 
-	/**
-	 * B_0, or the user-specified minimum eigenflow half-life threshold
-	 * for an eigenvector/eigenvalue pair to be considered. Increasing
-	 * B_0 equates to fewer clusters
-	 */
-	String BETA = "org.apache.mahout.clustering.spectral.beta";
-	
-	/**
-	 * Tau, or the user-specified threshold for making cuts (setting edge
-	 * affinities to 0) after performing non-maximal suppression on edge weight
-	 * sensitivies. Increasing tau equates to more edge cuts
-	 */
-	String TAU = "org.apache.mahout.clustering.spectral.tau";
-	
-	/**
-	 * The normalization factor for computing the cut threshold
-	 */
-	String DELTA = "org.apache.mahout.clustering.spectral.delta";
-	
-	/**
-	 * Epsilon, or the user-specified coefficient that works in tandem with 
-	 * MINIMUM_HALF_LIFE to determine which eigenvector/eigenvalue pairs to use.
-	 * Increasing epsilon equates to fewer eigenvector/eigenvalue pairs
-	 */
-	String EPSILON = "org.apache.mahout.clustering.spectral.epsilon";
-	
-	/**
-	 * Base path to the location on HDFS where the diagonal matrix (a vector)
-	 * and the list of eigenvalues will be stored for one of the map/reduce 
-	 * jobs in Eigencuts.
-	 */
-	String VECTOR_CACHE_BASE = "org.apache.mahout.clustering.spectral.eigencuts.vectorcache";
-	
-	/**
-	 * Refers to the dimensions of the raw affinity matrix input. Since this
-	 * matrix is symmetrical, it is a square matrix, hence all its dimensions
-	 * are equal.
-	 */
-	String AFFINITY_DIMENSIONS = "org.apache.mahout.clustering.spectral.eigencuts.affinitydimensions";
-	
-	/**
-	 * Refers to the Path to the SequenceFile representing the affinity matrix
-	 */
-	String AFFINITY_PATH = "org.apache.mahout.clustering.spectral.eigencuts.affinitypath";
-	
-	/**
-	 * Refers to the Path to the SequenceFile representing the cut matrix
-	 */
-	String CUTMATRIX_PATH = "org.apache.mahout.clustering.spectral.eigencuts.cutmatrixpath";
-	
-	/**
-     * Sets the SequenceFile index for the list of eigenvalues.
-     */
-    final int EIGENVALUES_CACHE_INDEX = 0;
-	
-	/**
-	 * Sets the SequenceFile index for the diagonal matrix. 
-	 */
-	final int DIAGONAL_CACHE_INDEX = 1;
+  /**
+   * B_0, or the user-specified minimum eigenflow half-life threshold
+   * for an eigenvector/eigenvalue pair to be considered. Increasing
+   * B_0 equates to fewer clusters
+   */
+  String BETA = "org.apache.mahout.clustering.spectral.beta";
+
+  /**
+   * Tau, or the user-specified threshold for making cuts (setting edge
+   * affinities to 0) after performing non-maximal suppression on edge weight
+   * sensitivies. Increasing tau equates to more edge cuts
+   */
+  String TAU = "org.apache.mahout.clustering.spectral.tau";
+
+  /**
+   * The normalization factor for computing the cut threshold
+   */
+  String DELTA = "org.apache.mahout.clustering.spectral.delta";
+
+  /**
+   * Epsilon, or the user-specified coefficient that works in tandem with
+   * MINIMUM_HALF_LIFE to determine which eigenvector/eigenvalue pairs to use.
+   * Increasing epsilon equates to fewer eigenvector/eigenvalue pairs
+   */
+  String EPSILON = "org.apache.mahout.clustering.spectral.epsilon";
+
+  /**
+   * Base path to the location on HDFS where the diagonal matrix (a vector)
+   * and the list of eigenvalues will be stored for one of the map/reduce
+   * jobs in Eigencuts.
+   */
+  String VECTOR_CACHE_BASE = "org.apache.mahout.clustering.spectral.eigencuts.vectorcache";
+
+  /**
+   * Refers to the dimensions of the raw affinity matrix input. Since this
+   * matrix is symmetrical, it is a square matrix, hence all its dimensions
+   * are equal.
+   */
+  String AFFINITY_DIMENSIONS = "org.apache.mahout.clustering.spectral.eigencuts.affinitydimensions";
+
+  /**
+   * Refers to the Path to the SequenceFile representing the affinity matrix
+   */
+  String AFFINITY_PATH = "org.apache.mahout.clustering.spectral.eigencuts.affinitypath";
+
+  /**
+   * Refers to the Path to the SequenceFile representing the cut matrix
+   */
+  String CUTMATRIX_PATH = "org.apache.mahout.clustering.spectral.eigencuts.cutmatrixpath";
+
+  /**
+   * Sets the SequenceFile index for the list of eigenvalues.
+   */
+  int EIGENVALUES_CACHE_INDEX = 0;
+
+  /**
+   * Sets the SequenceFile index for the diagonal matrix.
+   */
+  int DIAGONAL_CACHE_INDEX = 1;
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityJob.java Fri Oct  1 11:00:16 2010
@@ -67,6 +67,9 @@ import org.apache.mahout.math.VectorWrit
  */
 public final class EigencutsSensitivityJob {
 
+  private EigencutsSensitivityJob() {
+  }
+
   /**
    * Initializes the configuration tasks, loads the needed data into
    * the HDFS cache, and executes the job.
@@ -74,19 +77,18 @@ public final class EigencutsSensitivityJ
    * @param eigenvalues Vector of eigenvalues
    * @param diagonal Vector representing the diagonal matrix
    * @param eigenvectors Path to the DRM of eigenvectors
-   * @param beta
-   * @param tau
-   * @param delta
-   * @param epsilon
    * @param output Path to the output matrix (will have between n and full-rank
    *                non-zero elements)
-   * @throws IOException
-   * @throws ClassNotFoundException
-   * @throws InterruptedException
    */
-  public static void runJob(Vector eigenvalues, Vector diagonal, Path 
-      eigenvectors, double beta, double tau, double delta, double epsilon, Path output) 
-      throws IOException, ClassNotFoundException, InterruptedException {
+  public static void runJob(Vector eigenvalues,
+                            Vector diagonal,
+                            Path eigenvectors,
+                            double beta,
+                            double tau,
+                            double delta,
+                            double epsilon,
+                            Path output)
+    throws IOException, ClassNotFoundException, InterruptedException {
     
     // save the two vectors to the distributed cache
     Configuration jobConfig = new Configuration();

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityMapper.java Fri Oct  1 11:00:16 2010
@@ -91,7 +91,7 @@ public class EigencutsSensitivityMapper 
       }
       
       // is this the smallest value in the column?
-      Integer column = new Integer(minInd);
+      Integer column = minInd;
       EigencutsSensitivityNode value = new EigencutsSensitivityNode(i, minInd, minS_ij);
       if (!columns.containsKey(column)) {
         columns.put(column, value);
@@ -103,7 +103,7 @@ public class EigencutsSensitivityMapper 
     
     // write whatever values made it through
     
-    for (EigencutsSensitivityNode e : columns.values().toArray(new EigencutsSensitivityNode[0])) {
+    for (EigencutsSensitivityNode e : columns.values()) {
       context.write(new IntWritable(e.getRow()), e);
     }
   }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityReducer.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityReducer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/eigencuts/EigencutsSensitivityReducer.java Fri Oct  1 11:00:16 2010
@@ -36,12 +36,11 @@ public class EigencutsSensitivityReducer
     Reducer<IntWritable, EigencutsSensitivityNode, IntWritable, VectorWritable> {
 
   @Override
-  protected void reduce(IntWritable key, Iterable<EigencutsSensitivityNode> arr, 
-      Context context) throws IOException, InterruptedException {
+  protected void reduce(IntWritable key, Iterable<EigencutsSensitivityNode> arr, Context context)
+    throws IOException, InterruptedException {
     Configuration conf = context.getConfiguration();
-    Vector v = new RandomAccessSparseVector(conf
-      .getInt(EigencutsKeys.AFFINITY_DIMENSIONS, Integer.MAX_VALUE), 100);
-    double threshold = Double.parseDouble(conf.get(EigencutsKeys.TAU)) / 
+    Vector v = new RandomAccessSparseVector(conf.getInt(EigencutsKeys.AFFINITY_DIMENSIONS, Integer.MAX_VALUE), 100);
+    double threshold = Double.parseDouble(conf.get(EigencutsKeys.TAU)) /
       Double.parseDouble(conf.get(EigencutsKeys.DELTA));
     
     for (EigencutsSensitivityNode n : arr) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/kmeans/SpectralKMeansDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/kmeans/SpectralKMeansDriver.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/kmeans/SpectralKMeansDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/spectral/kmeans/SpectralKMeansDriver.java Fri Oct  1 11:00:16 2010
@@ -41,30 +41,31 @@ import org.apache.mahout.common.Abstract
 import org.apache.mahout.common.HadoopUtil;
 import org.apache.mahout.common.commandline.DefaultOptionCreator;
 import org.apache.mahout.common.distance.DistanceMeasure;
-import org.apache.mahout.common.distance.EuclideanDistanceMeasure;
-import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
 import org.apache.mahout.math.DenseMatrix;
 import org.apache.mahout.math.Matrix;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.hadoop.DistributedRowMatrix;
 import org.apache.mahout.math.hadoop.decomposer.DistributedLanczosSolver;
 import org.apache.mahout.math.hadoop.decomposer.EigenVerificationJob;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Implementation of the EigenCuts spectral clustering algorithm.
  */
 public class SpectralKMeansDriver extends AbstractJob {
 
-  public static final boolean DEBUG = false;
+  private static final Logger log = LoggerFactory.getLogger(SpectralKMeansDriver.class);
 
   public static final double OVERSHOOT_MULTIPLIER = 2.0;
 
-  public static void main(String args[]) throws Exception {
+  public static void main(String[] args) throws Exception {
     ToolRunner.run(new SpectralKMeansDriver(), args);
   }
 
   @Override
-  public int run(String[] arg0) throws Exception {
+  public int run(String[] arg0)
+    throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, InterruptedException {
     // set up command line options
     Configuration conf = getConf();
     addInputOption();
@@ -109,12 +110,6 @@ public class SpectralKMeansDriver extend
    * @param measure the DistanceMeasure for the k-Means calculations
    * @param convergenceDelta the double convergence delta for the k-Means calculations
    * @param maxIterations the int maximum number of iterations for the k-Means calculations
-   * 
-   * @throws IOException
-   * @throws InterruptedException
-   * @throws ClassNotFoundException
-   * @throws IllegalAccessException
-   * @throws InstantiationException
    */
   public static void run(Configuration conf,
                          Path input,
@@ -123,8 +118,8 @@ public class SpectralKMeansDriver extend
                          int clusters,
                          DistanceMeasure measure,
                          double convergenceDelta,
-                         int maxIterations) throws IOException, InterruptedException, ClassNotFoundException,
-      IllegalAccessException, InstantiationException {
+                         int maxIterations)
+    throws IOException, InterruptedException, ClassNotFoundException, IllegalAccessException, InstantiationException {
     // create a few new Paths for temp files and transformations
     Path outputCalc = new Path(output, "calculations");
     Path outputTmp = new Path(output, "temporary");
@@ -148,15 +143,16 @@ public class SpectralKMeansDriver extend
     // and calculate the normalized Laplacian of the form:
     // L = D^(-0.5)AD^(-0.5)
     Vector D = MatrixDiagonalizeJob.runJob(affSeqFiles, numDims);
-    DistributedRowMatrix L = VectorMatrixMultiplicationJob.runJob(affSeqFiles, D, new Path(outputCalc, "laplacian-"
-        + (System.nanoTime() & 0xFF)));
+    DistributedRowMatrix L =
+        VectorMatrixMultiplicationJob.runJob(affSeqFiles, D,
+            new Path(outputCalc, "laplacian-" + (System.nanoTime() & 0xFF)));
     L.configure(new JobConf(conf));
 
     // Next step: perform eigen-decomposition using LanczosSolver
     // since some of the eigen-output is spurious and will be eliminated
     // upon verification, we have to aim to overshoot and then discard
     // unnecessary vectors later
-    int overshoot = (int) ((double) clusters * SpectralKMeansDriver.OVERSHOOT_MULTIPLIER);
+    int overshoot = (int) ((double) clusters * OVERSHOOT_MULTIPLIER);
     List<Double> eigenValues = new ArrayList<Double>(overshoot);
     Matrix eigenVectors = new DenseMatrix(overshoot, numDims);
     DistributedLanczosSolver solver = new DistributedLanczosSolver();
@@ -180,7 +176,7 @@ public class SpectralKMeansDriver extend
     DistributedRowMatrix W = new DistributedRowMatrix(cleanedEigens, new Path(cleanedEigens, "tmp"), clusters, numDims);
     W.configure(new JobConf());
     DistributedRowMatrix Wtrans = W.transpose();
-    //		DistributedRowMatrix Wt = W.transpose();
+    //    DistributedRowMatrix Wt = W.transpose();
 
     // next step: normalize the rows of Wt to unit length
     Path unitVectors = new Path(outputCalc, "unitvectors-" + (System.nanoTime() & 0xFF));
@@ -188,18 +184,6 @@ public class SpectralKMeansDriver extend
     DistributedRowMatrix Wt = new DistributedRowMatrix(unitVectors, new Path(unitVectors, "tmp"), clusters, numDims);
     Wt.configure(new JobConf());
 
-    //		Iterator<MatrixSlice> i = W.iterator();
-    //		int x = 0;
-    //		while (i.hasNext()) {
-    //			Vector v = i.next().vector();
-    //			System.out.println("EIGENVECTOR " + (++x));
-    //			for (int c = 0; c < v.size(); c++) {
-    //				System.out.print(v.get(c) + " ");
-    //			}
-    //			System.out.println();
-    //		}
-    //		System.exit(0);
-
     // Finally, perform k-means clustering on the rows of L (or W)
     // generate random initial clusters
     Path initialclusters = RandomSeedGenerator.buildRandom(Wt.getRowPath(),
@@ -217,17 +201,9 @@ public class SpectralKMeansDriver extend
     // The value is the weighted vector
     WeightedVectorWritable value = new WeightedVectorWritable();
 
-    //	    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
     int id = 0;
     while (reader.next(clusterId, value)) {
-      //	    	Integer key = new Integer(clusterId.get());
-      //	    	if (map.containsKey(key)) {
-      //	    		Integer count = map.remove(key);
-      //	    		map.put(key, new Integer(count.intValue() + 1));
-      //	    	} else {
-      //	    		map.put(key, new Integer(1));
-      //	    	}
-      System.out.println((id++) + ": " + clusterId.get());
+      log.info("{}: {}", id++, clusterId.get());
       clusterId = new IntWritable(0);
       value = new WeightedVectorWritable();
     }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java Fri Oct  1 11:00:16 2010
@@ -166,6 +166,7 @@ public final class DefaultOptionCreator 
    * Used by Dirichlet, FuzzyKmeans, Kmeans and LDA
    * @deprecated 
    */
+  @Deprecated
   public static DefaultOptionBuilder numReducersOption() {
     return new DefaultOptionBuilder().withLongName(MAX_REDUCERS_OPTION).withRequired(false).withShortName("r")
         .withArgument(new ArgumentBuilder().withName(MAX_REDUCERS_OPTION).withDefault("2")

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ep/EvolutionaryProcess.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ep/EvolutionaryProcess.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ep/EvolutionaryProcess.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ep/EvolutionaryProcess.java Fri Oct  1 11:00:16 2010
@@ -184,7 +184,7 @@ public class EvolutionaryProcess<T exten
 
   public void close() {
     List<Runnable> remainingTasks = pool.shutdownNow();
-    if (remainingTasks.size() > 0) {
+    if (!remainingTasks.isEmpty()) {
       throw new EarlyTerminationException("Had to forcefully shut down " + remainingTasks.size() + " tasks");
     }
   }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ep/Mapping.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ep/Mapping.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ep/Mapping.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ep/Mapping.java Fri Oct  1 11:00:16 2010
@@ -101,7 +101,7 @@ public abstract class Mapping implements
    * @param scale  Defines how sharp the boundaries are.
    * @return A mapping that satisfies the desired constraint.
    */
-  public static Mapping softLimit(double min, double max, final double scale) {
+  public static Mapping softLimit(double min, double max, double scale) {
     return new SoftLimit(min, max, scale);
   }
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/ep/Payload.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/ep/Payload.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/ep/Payload.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/ep/Payload.java Fri Oct  1 11:00:16 2010
@@ -1,3 +1,20 @@
+/**
+ * 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.ep;
 
 /**
@@ -12,6 +29,6 @@ package org.apache.mahout.ep;
  * @param <T>
  */
 public interface Payload<T> {
-  public T copy();
-  public void update(double[] params);
+  T copy();
+  void update(double[] params);
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/DistributedLanczosSolver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/DistributedLanczosSolver.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/DistributedLanczosSolver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/DistributedLanczosSolver.java Fri Oct  1 11:00:16 2010
@@ -65,17 +65,6 @@ public class DistributedLanczosSolver ex
   
   /**
    * Factored-out LanczosSolver for the purpose of invoking it programmatically
-   * @param originalConfig
-   * @param inputPathString
-   * @param outputTmpPath
-   * @param numRows
-   * @param numCols
-   * @param isSymmetric
-   * @param desiredRank
-   * @param eigenVectors
-   * @param eigenValues
-   * @param outputEigenVectorPathString
-   * @throws IOException
    */
   public void runJob(Configuration originalConfig, Path inputPath,
 		  			Path outputTmpPath, int numRows, int numCols,

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/EigenVerificationJob.java Fri Oct  1 11:00:16 2010
@@ -205,7 +205,7 @@ public class EigenVerificationJob extend
       // (latter is built-in, since numEigensWritten will always be > 0
       numEigensWritten++;
       if (numEigensWritten == maxEigensToKeep) {
-        log.info("{} of the {} total eigens have been written", new Integer(maxEigensToKeep), new Integer(prunedEigenMeta.size()));
+        log.info("{} of the {} total eigens have been written", maxEigensToKeep, prunedEigenMeta.size());
         break;
       }
     }
@@ -299,7 +299,7 @@ public class EigenVerificationJob extend
     corpus = c;
 
     eigenVerifier = new SimpleEigenVerifier();
-    OrthonormalityVerifier orthoVerifier = new OrthonormalityVerifier();
+    //OrthonormalityVerifier orthoVerifier = new OrthonormalityVerifier();
     VectorIterable pairwiseInnerProducts = computePairwiseInnerProducts();
     // FIXME: Why is the above vector computed if it is never used?
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/vector/DistributedUncenteredCosineVectorSimilarity.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/vector/DistributedUncenteredCosineVectorSimilarity.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/vector/DistributedUncenteredCosineVectorSimilarity.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/vector/DistributedUncenteredCosineVectorSimilarity.java Fri Oct  1 11:00:16 2010
@@ -1,3 +1,20 @@
+/**
+ * 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.math.hadoop.similarity.vector;
 
 import org.apache.mahout.math.hadoop.similarity.Cooccurrence;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GlobalOnlineAuc.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GlobalOnlineAuc.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GlobalOnlineAuc.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GlobalOnlineAuc.java Fri Oct  1 11:00:16 2010
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.math.stats;
 
+import org.apache.mahout.common.RandomUtils;
 import org.apache.mahout.math.DenseMatrix;
 import org.apache.mahout.math.DenseVector;
 import org.apache.mahout.math.Matrix;
@@ -48,7 +49,7 @@ public class GlobalOnlineAuc implements 
 
   // FIFO has distinctly the best properties as a policy.  See OnlineAucTest for details
   private ReplacementPolicy policy = ReplacementPolicy.FIFO;
-  private transient Random random = org.apache.mahout.common.RandomUtils.getRandom();
+  private final transient Random random = RandomUtils.getRandom();
   private final Matrix scores;
   private final Vector averages;
   private final Vector samples;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GroupedOnlineAuc.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GroupedOnlineAuc.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GroupedOnlineAuc.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/stats/GroupedOnlineAuc.java Fri Oct  1 11:00:16 2010
@@ -30,7 +30,7 @@ import java.util.Map;
  * user (or user cluster) helps avoid optimizing for the wrong quality.
  */
 public class GroupedOnlineAuc implements OnlineAuc {
-  private Map<String, OnlineAuc> map = Maps.newHashMap();
+  private final Map<String, OnlineAuc> map = Maps.newHashMap();
   private GlobalOnlineAuc.ReplacementPolicy policy;
   private int windowSize;
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/AdaptiveWordValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/AdaptiveWordValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/AdaptiveWordValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/AdaptiveWordValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -47,17 +47,6 @@ public class AdaptiveWordValueEncoder ex
     super.addToVector(originalForm, weight, data);
   }
 
-  /**
-   * Adds a value to a vector.
-   *
-   * @param originalForm The original form of the value as a byte array.
-   * @param data         The vector to which the value should be added.
-   */
-  @Override
-  public void addToVector(byte[] originalForm, double weight, Vector data) {
-    super.addToVector(originalForm, weight, data);
-  }
-
   @Override
   protected int hashForProbe(byte[] originalForm, int dataSize, String name, int probe) {
     return super.hashForProbe(originalForm, dataSize, name, probe);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingContinuousValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingContinuousValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingContinuousValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingContinuousValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -50,7 +50,7 @@ public class CachingContinuousValueEncod
   protected int hashForProbe(String originalForm, int dataSize, String name, int probe) {
     if (dataSize != this.dataSize) {
       throw new IllegalArgumentException("dataSize argument ["
-          + dataSize + "] does not match expected dataSize [" + this.dataSize + "]");
+          + dataSize + "] does not match expected dataSize [" + this.dataSize + ']');
     }
     if (caches[probe].containsKey(originalForm.hashCode())) {
       return caches[probe].get(originalForm.hashCode());

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingStaticWordValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingStaticWordValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingStaticWordValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/CachingStaticWordValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -50,7 +50,7 @@ public class CachingStaticWordValueEncod
   protected int hashForProbe(String originalForm, int dataSize, String name, int probe) {
     if (dataSize != this.dataSize) {
       throw new IllegalArgumentException("dataSize argument ["
-          + dataSize + "] does not match expected dataSize [" + this.dataSize + "]");
+          + dataSize + "] does not match expected dataSize [" + this.dataSize + ']');
     }
     if (caches[probe].containsKey(originalForm.hashCode())) {
       return caches[probe].get(originalForm.hashCode());

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/FeatureVectorEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/FeatureVectorEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/FeatureVectorEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/FeatureVectorEncoder.java Fri Oct  1 11:00:16 2010
@@ -36,7 +36,7 @@ public abstract class FeatureVectorEncod
   protected static final int CONTINUOUS_VALUE_HASH_SEED = 1;
   protected static final int WORD_LIKE_VALUE_HASH_SEED = 100;
 
-  private static final byte[] EMPTY_ARRAY = new byte[0];;
+  private static final byte[] EMPTY_ARRAY = new byte[0];
 
   private final String name;
   private int probes;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/InteractionValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/InteractionValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/InteractionValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/InteractionValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -19,6 +19,7 @@ package org.apache.mahout.vectors;
 
 import org.apache.mahout.math.Vector;
 
+import java.util.Arrays;
 import java.util.Locale;
 
 public class InteractionValueEncoder extends FeatureVectorEncoder {
@@ -85,7 +86,7 @@ public class InteractionValueEncoder ext
         for (Integer j : jValues) {
           int n = (k + j) % data.size();
           if (isTraceEnabled()) {
-            trace(String.format("%s:%s", originalForm1, originalForm2), n);            
+            trace(String.format("%s:%s", Arrays.toString(originalForm1), Arrays.toString(originalForm2)), n);
           }
           data.set(n, data.get(n) + w);
         }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/MurmurHash.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/MurmurHash.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/MurmurHash.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/MurmurHash.java Fri Oct  1 11:00:16 2010
@@ -70,9 +70,8 @@ public final class MurmurHash {
 
     int h = seed ^ buf.remaining();
 
-    int k;
     while (buf.remaining() >= 4) {
-      k = buf.getInt();
+      int k = buf.getInt();
 
       k *= m;
       k ^= k >>> r;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/StaticWordValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/StaticWordValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/StaticWordValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/StaticWordValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -34,7 +34,7 @@ import java.util.Map;
 public class StaticWordValueEncoder extends WordValueEncoder {
   private Map<String, Double> dictionary;
   private double missingValueWeight = 1;
-  private byte[] nameBytes;
+  private final byte[] nameBytes;
 
   public StaticWordValueEncoder(String name) {
     super(name);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/TextValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/TextValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/TextValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/TextValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -38,7 +38,7 @@ public class TextValueEncoder extends Fe
   private static final double LOG_2 = Math.log(2);
 
   private FeatureVectorEncoder wordEncoder;
-  private Multiset<String> counts;
+  private final Multiset<String> counts;
 
   public TextValueEncoder(String name) {
     super(name, 2);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectors/WordValueEncoder.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectors/WordValueEncoder.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectors/WordValueEncoder.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectors/WordValueEncoder.java Fri Oct  1 11:00:16 2010
@@ -26,7 +26,7 @@ import java.util.Locale;
  * sub-class.
  */
 public abstract class WordValueEncoder extends FeatureVectorEncoder {
-  private byte[] nameBytes;
+  private final byte[] nameBytes;
 
   protected WordValueEncoder(String name) {
     super(name, 2);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJobTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJobTest.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJobTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJobTest.java Fri Oct  1 11:00:16 2010
@@ -512,7 +512,7 @@ public class RecommenderJobTest extends 
     EasyMock.replay(context);
 
     VectorAndPrefsWritable vectorAndPrefs = new VectorAndPrefsWritable(similarityColumn, Arrays.asList(123L, 456L),
-        Arrays.asList(1f, 3f));
+        Arrays.asList(1.0f, 3.0f));
 
     new PartialMultiplyMapper().map(new VarIntWritable(1), vectorAndPrefs, context);
 

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/ModelSerializerTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/ModelSerializerTest.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/ModelSerializerTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/ModelSerializerTest.java Fri Oct  1 11:00:16 2010
@@ -44,12 +44,12 @@ public final class ModelSerializerTest e
   public void testSoftLimitDeserialization() {
     Mapping m = ModelSerializer.gson().fromJson(new StringReader("{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}"), Mapping.SoftLimit.class);
     assertTrue(m instanceof Mapping.SoftLimit);
-    assertEquals((-18.420680743952367 + -2.3025850929940455) / 2, m.apply(0), 1.0e-6);
+    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);
 
     String data = "{\"class\":\"org.apache.mahout.ep.Mapping$SoftLimit\",\"value\":{\"min\":-18.420680743952367,\"max\":-2.3025850929940455,\"scale\":1.0}}";
     m = ModelSerializer.gson().fromJson(new StringReader(data), Mapping.class);
     assertTrue(m instanceof Mapping.SoftLimit);
-    assertEquals((-18.420680743952367 + -2.3025850929940455) / 2, m.apply(0), 1.0e-6);
+    assertEquals((-18.420680743952367 - 2.3025850929940455) / 2, m.apply(0), 1.0e-6);
   }
 
   @Test

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestGaussianAccumulators.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestGaussianAccumulators.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestGaussianAccumulators.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestGaussianAccumulators.java Fri Oct  1 11:00:16 2010
@@ -17,7 +17,7 @@
 package org.apache.mahout.clustering;
 
 import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
 
 import org.apache.mahout.clustering.dirichlet.UncommonDistributions;
 import org.apache.mahout.common.MahoutTestCase;
@@ -28,12 +28,13 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TestGaussianAccumulators extends MahoutTestCase {
+public final class TestGaussianAccumulators extends MahoutTestCase {
 
-  private static List<VectorWritable> sampleData = new ArrayList<VectorWritable>();
+  private Collection<VectorWritable> sampleData = new ArrayList<VectorWritable>();
 
   private static final Logger log = LoggerFactory.getLogger(TestGaussianAccumulators.class);
 
+  @Override
   @Before
   public void setUp() throws Exception {
     super.setUp();
@@ -54,7 +55,7 @@ public class TestGaussianAccumulators ex
    *          double standard deviation of the samples
    * @throws Exception 
    */
-  public static void generateSamples(int num, double mx, double my, double sd) throws Exception {
+  private void generateSamples(int num, double mx, double my, double sd) {
     log.info("Generating {} samples m=[{}, {}] sd={}", new Object[] { num, mx, my, sd });
     for (int i = 0; i < num; i++) {
       sampleData.add(new VectorWritable(new DenseVector(new double[] { UncommonDistributions.rNorm(mx, sd),
@@ -76,7 +77,7 @@ public class TestGaussianAccumulators ex
    * @param sdy
    *          double y-value standard deviation of the samples
    */
-  public static void generate2dSamples(int num, double mx, double my, double sdx, double sdy) {
+  private void generate2dSamples(int num, double mx, double my, double sdx, double sdy) {
     log.info("Generating {} samples m=[{}, {}] sd=[{}, {}]", new Object[] { num, mx, my, sdx, sdy });
     for (int i = 0; i < num; i++) {
       sampleData.add(new VectorWritable(new DenseVector(new double[] { UncommonDistributions.rNorm(mx, sdx),
@@ -84,7 +85,7 @@ public class TestGaussianAccumulators ex
     }
   }
 
-  private void generateSamples() throws Exception {
+  private void generateSamples() {
     generate2dSamples(500, 1, 2, 3, 4);
   }
 

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestVectorModelClassifier.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestVectorModelClassifier.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestVectorModelClassifier.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestVectorModelClassifier.java Fri Oct  1 11:00:16 2010
@@ -92,7 +92,6 @@ public final class TestVectorModelClassi
       classifier.classify(new DenseVector(2));
       fail("Expected NotImplementedException");
     } catch (NotImplementedException e) {
-      assertTrue(true);
     }
   }
 

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/fuzzykmeans/TestFuzzyKmeansClustering.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/fuzzykmeans/TestFuzzyKmeansClustering.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/fuzzykmeans/TestFuzzyKmeansClustering.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/fuzzykmeans/TestFuzzyKmeansClustering.java Fri Oct  1 11:00:16 2010
@@ -630,7 +630,7 @@ public final class TestFuzzyKmeansCluste
       Map<Integer, List<WeightedVectorWritable>> refClusters = new HashMap<Integer, List<WeightedVectorWritable>>();
       Collection<Vector> pointsVectors = new ArrayList<Vector>();
       for (VectorWritable point : points) {
-        pointsVectors.add((Vector) point.get());
+        pointsVectors.add(point.get());
       }
 
       List<List<SoftCluster>> clusters = FuzzyKMeansClusterer.clusterPoints(pointsVectors,

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/meanshift/TestMeanShift.java Fri Oct  1 11:00:16 2010
@@ -143,7 +143,6 @@ public final class TestMeanShift extends
       printImage(canopies);
       System.out.println(iter++);
     }
-    assertTrue(true);
   }
 
   /**

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestAffinityMatrixInputJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestAffinityMatrixInputJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestAffinityMatrixInputJob.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestAffinityMatrixInputJob.java Fri Oct  1 11:00:16 2010
@@ -32,7 +32,6 @@ import org.apache.mahout.common.DummyRec
 import org.apache.mahout.common.MahoutTestCase;
 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.DistributedRowMatrix.MatrixEntryWritable;
 import org.junit.Test;
 
@@ -65,34 +64,34 @@ import org.junit.Test;
  */
 public class TestAffinityMatrixInputJob extends MahoutTestCase {
   
-  private String [] raw = {"0,0,0", "0,1,5", "0,2,10", "1,0,5", "1,1,0", 
-                          "1,2,20", "2,0,10", "2,1,20", "2,2,0"};
-  private int rawDimensions = 3;
+  private static final String [] RAW = {"0,0,0", "0,1,5", "0,2,10", "1,0,5", "1,1,0",
+                                        "1,2,20", "2,0,10", "2,1,20", "2,2,0"};
+  private static final int RAW_DIMENSIONS = 3;
 
   @Test
   public void testAffinityMatrixInputMapper() throws Exception {
     AffinityMatrixInputMapper mapper = new AffinityMatrixInputMapper();
     Configuration conf = new Configuration();
-    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, rawDimensions);
+    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, RAW_DIMENSIONS);
     
     // set up the dummy writer and the M/R context
-    DummyRecordWriter<IntWritable, DistributedRowMatrix.MatrixEntryWritable> writer = 
-      new DummyRecordWriter<IntWritable, DistributedRowMatrix.MatrixEntryWritable>();
-    Mapper<LongWritable, Text, IntWritable, DistributedRowMatrix.MatrixEntryWritable>.Context 
+    DummyRecordWriter<IntWritable, MatrixEntryWritable> writer =
+      new DummyRecordWriter<IntWritable, MatrixEntryWritable>();
+    Mapper<LongWritable, Text, IntWritable, MatrixEntryWritable>.Context 
       context = DummyRecordWriter.build(mapper, conf, writer);
 
     // loop through all the points and test each one is converted
     // successfully to a DistributedRowMatrix.MatrixEntry
-    for (int i = 0; i < raw.length; i++) {
-      mapper.map(new LongWritable(), new Text(raw[i]), context);
+    for (String s : RAW) {
+      mapper.map(new LongWritable(), new Text(s), context);
     }
 
     // test the data was successfully constructed
-    assertEquals("Number of map results", rawDimensions, writer.getData().size());
+    assertEquals("Number of map results", RAW_DIMENSIONS, writer.getData().size());
     Set<IntWritable> keys = writer.getData().keySet();
     for (IntWritable i : keys) {
       List<MatrixEntryWritable> row = writer.getData().get(i);
-      assertEquals("Number of items in row", rawDimensions, row.size());
+      assertEquals("Number of items in row", RAW_DIMENSIONS, row.size());
     }
   }
   
@@ -100,18 +99,18 @@ public class TestAffinityMatrixInputJob 
   public void testAffinitymatrixInputReducer() throws Exception {
     AffinityMatrixInputMapper mapper = new AffinityMatrixInputMapper();
     Configuration conf = new Configuration();
-    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, rawDimensions);
+    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, RAW_DIMENSIONS);
     
     // set up the dummy writer and the M/R context
-    DummyRecordWriter<IntWritable, DistributedRowMatrix.MatrixEntryWritable> mapWriter = 
-      new DummyRecordWriter<IntWritable, DistributedRowMatrix.MatrixEntryWritable>();
-    Mapper<LongWritable, Text, IntWritable, DistributedRowMatrix.MatrixEntryWritable>.Context 
+    DummyRecordWriter<IntWritable, MatrixEntryWritable> mapWriter =
+      new DummyRecordWriter<IntWritable, MatrixEntryWritable>();
+    Mapper<LongWritable, Text, IntWritable, MatrixEntryWritable>.Context
       mapContext = DummyRecordWriter.build(mapper, conf, mapWriter);
 
     // loop through all the points and test each one is converted
     // successfully to a DistributedRowMatrix.MatrixEntry
-    for (int i = 0; i < raw.length; i++) {
-      mapper.map(new LongWritable(), new Text(raw[i]), mapContext);
+    for (String s : RAW) {
+      mapper.map(new LongWritable(), new Text(s), mapContext);
     }
     // store the data for checking later
     Map<IntWritable, List<MatrixEntryWritable>> map = mapWriter.getData();
@@ -120,7 +119,7 @@ public class TestAffinityMatrixInputJob 
     AffinityMatrixInputReducer reducer = new AffinityMatrixInputReducer();
     DummyRecordWriter<IntWritable, VectorWritable> redWriter = 
       new DummyRecordWriter<IntWritable, VectorWritable>();
-    Reducer<IntWritable, DistributedRowMatrix.MatrixEntryWritable, 
+    Reducer<IntWritable, MatrixEntryWritable,
       IntWritable, VectorWritable>.Context redContext = DummyRecordWriter
       .build(reducer, conf, redWriter, IntWritable.class, MatrixEntryWritable.class);
     for (IntWritable key : mapWriter.getKeys()) {
@@ -128,7 +127,7 @@ public class TestAffinityMatrixInputJob 
     }
     
     // check that all the elements are correctly ordered
-    assertEquals("Number of reduce results", rawDimensions, redWriter.getData().size());
+    assertEquals("Number of reduce results", RAW_DIMENSIONS, redWriter.getData().size());
     for (IntWritable row : redWriter.getKeys()) {
       List<VectorWritable> list = redWriter.getValue(row);
       assertEquals("Should only be one vector", 1, list.size());

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestMatrixDiagonalizeJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestMatrixDiagonalizeJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestMatrixDiagonalizeJob.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestMatrixDiagonalizeJob.java Fri Oct  1 11:00:16 2010
@@ -41,12 +41,14 @@ import org.junit.Test;
  */
 public class TestMatrixDiagonalizeJob extends MahoutTestCase {
   
-  private double [][] raw = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
-  private int rawDimensions = 3;
+  private static final double[][] RAW = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
+  private static final int RAW_DIMENSIONS = 3;
   
   private static double rowSum(double [] row) {
     double sum = 0;
-    for (int i = 0; i < row.length; i++) { sum += row[i]; }
+    for (double r : row) {
+      sum += r;
+    }
     return sum;
   }
 
@@ -54,7 +56,7 @@ public class TestMatrixDiagonalizeJob ex
   public void testMatrixDiagonalizeMapper() throws Exception {
     MatrixDiagonalizeMapper mapper = new MatrixDiagonalizeMapper();
     Configuration conf = new Configuration();
-    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, rawDimensions);
+    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, RAW_DIMENSIONS);
     
     // set up the dummy writers
     DummyRecordWriter<NullWritable, IntDoublePairWritable> writer = 
@@ -63,14 +65,14 @@ public class TestMatrixDiagonalizeJob ex
       context = DummyRecordWriter.build(mapper, conf, writer);
     
     // perform the mapping
-    for (int i = 0; i < rawDimensions; i++) {
-      RandomAccessSparseVector toAdd = new RandomAccessSparseVector(rawDimensions);
-      toAdd.assign(raw[i]);
+    for (int i = 0; i < RAW_DIMENSIONS; i++) {
+      RandomAccessSparseVector toAdd = new RandomAccessSparseVector(RAW_DIMENSIONS);
+      toAdd.assign(RAW[i]);
       mapper.map(new IntWritable(i), new VectorWritable(toAdd), context);
     }
     
     // check the number of the results
-    assertEquals("Number of map results", rawDimensions, 
+    assertEquals("Number of map results", RAW_DIMENSIONS,
         writer.getValue(NullWritable.get()).size());
   }
   
@@ -78,7 +80,7 @@ public class TestMatrixDiagonalizeJob ex
  public void testMatrixDiagonalizeReducer() throws Exception {
     MatrixDiagonalizeMapper mapper = new MatrixDiagonalizeMapper();
     Configuration conf = new Configuration();
-    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, rawDimensions);
+    conf.setInt(EigencutsKeys.AFFINITY_DIMENSIONS, RAW_DIMENSIONS);
     
     // set up the dummy writers
     DummyRecordWriter<NullWritable, IntDoublePairWritable> mapWriter = 
@@ -87,9 +89,9 @@ public class TestMatrixDiagonalizeJob ex
       mapContext = DummyRecordWriter.build(mapper, conf, mapWriter);
     
     // perform the mapping
-    for (int i = 0; i < rawDimensions; i++) {
-      RandomAccessSparseVector toAdd = new RandomAccessSparseVector(rawDimensions);
-      toAdd.assign(raw[i]);
+    for (int i = 0; i < RAW_DIMENSIONS; i++) {
+      RandomAccessSparseVector toAdd = new RandomAccessSparseVector(RAW_DIMENSIONS);
+      toAdd.assign(RAW[i]);
       mapper.map(new IntWritable(i), new VectorWritable(toAdd), mapContext);
     }
     
@@ -109,7 +111,7 @@ public class TestMatrixDiagonalizeJob ex
     assertEquals("Only a single resulting vector", 1, list.size());
     Vector v = list.get(0).get();
     for (int i = 0; i < v.size(); i++) {
-      assertEquals("Element sum is correct", rowSum(raw[i]), v.get(i),0.01);
+      assertEquals("Element sum is correct", rowSum(RAW[i]), v.get(i),0.01);
     }
   }
 }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestUnitVectorizerJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestUnitVectorizerJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestUnitVectorizerJob.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestUnitVectorizerJob.java Fri Oct  1 11:00:16 2010
@@ -32,7 +32,7 @@ import org.junit.Test;
 
 public class TestUnitVectorizerJob extends MahoutTestCase {
 
-  private double [][] raw = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
+  private static final double [][] RAW = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} };
 
   @Test
   public void testUnitVectorizerMapper() throws Exception {
@@ -46,15 +46,15 @@ public class TestUnitVectorizerJob exten
       context = DummyRecordWriter.build(mapper, conf, writer);
     
     // perform the mapping
-    for (int i = 0; i < raw.length; i++) {
-      Vector vector = new RandomAccessSparseVector(raw[i].length);
-      vector.assign(raw[i]);
+    for (int i = 0; i < RAW.length; i++) {
+      Vector vector = new RandomAccessSparseVector(RAW[i].length);
+      vector.assign(RAW[i]);
       mapper.map(new IntWritable(i), new VectorWritable(vector), context);
     }
     
     // check the results
-    assertEquals("Number of map results", raw.length, writer.getData().size());
-    for (int i = 0; i < raw.length; i++) {
+    assertEquals("Number of map results", RAW.length, writer.getData().size());
+    for (int i = 0; i < RAW.length; i++) {
       IntWritable key = new IntWritable(i);
       List<VectorWritable> list = writer.getValue(key);
       assertEquals("Only one element per row", 1, list.size());

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorCache.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorCache.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorCache.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorCache.java Fri Oct  1 11:00:16 2010
@@ -34,14 +34,14 @@ import org.junit.Test;
 
 public class TestVectorCache extends MahoutTestCase {
 
-  private double [] vector = { 1, 2, 3, 4 };
+  private static final double [] VECTOR = { 1, 2, 3, 4 };
   
   @Test
   public void testSave() throws Exception {
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.get(conf);
     IntWritable key = new IntWritable(0);
-    Vector value = new DenseVector(vector);
+    Vector value = new DenseVector(VECTOR);
     Path path = getTestTempDirPath("output");
     
     // write the vector out
@@ -63,7 +63,7 @@ public class TestVectorCache extends Mah
     Configuration conf = new Configuration();
     FileSystem fs = FileSystem.get(conf);
     IntWritable key = new IntWritable(0);
-    Vector value = new DenseVector(vector);
+    Vector value = new DenseVector(VECTOR);
     Path path = getTestTempDirPath("output");
     
     // write the vector
@@ -80,14 +80,14 @@ public class TestVectorCache extends Mah
     Vector result = VectorCache.load(key, conf);
     
     // are they the same?
-    assertTrue("Vector is not null", result != null);
-    assertTrue("Loaded vector is identical to original", result.equals(value));
+    assertNotNull("Vector is not null", result);
+    assertEquals("Loaded vector is identical to original", result, value);
   }
   
   @Test
   public void testAll() throws Exception {
     Configuration conf = new Configuration();
-    Vector v = new DenseVector(vector);
+    Vector v = new DenseVector(VECTOR);
     Path toSave = getTestTempDirPath("output");
     IntWritable key = new IntWritable(0);
     
@@ -99,7 +99,7 @@ public class TestVectorCache extends Mah
     Vector v2 = VectorCache.load(key, conf);
     
     // are they the same?
-    assertTrue("Vector is not null", v2 != null);
-    assertTrue("Vectors are identical", v2.equals(v));
+    assertNotNull("Vector is not null", v2);
+    assertEquals("Vectors are identical", v2, v);
   }
 }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorMatrixMultiplicationJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorMatrixMultiplicationJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorMatrixMultiplicationJob.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/common/TestVectorMatrixMultiplicationJob.java Fri Oct  1 11:00:16 2010
@@ -37,8 +37,8 @@ import org.junit.Test;
  */
 public class TestVectorMatrixMultiplicationJob extends MahoutTestCase {
   
-  private double [][] matrix = { {1, 1}, {2, 3} };
-  private double [] vector = {9, 16};
+  private static final double [][] MATRIX = { {1, 1}, {2, 3} };
+  private static final double [] VECTOR = {9, 16};
   
   @Test
   public void testVectorMatrixMultiplicationMapper() throws Exception {
@@ -46,7 +46,7 @@ public class TestVectorMatrixMultiplicat
     Configuration conf = new Configuration();
     
     // set up all the parameters for the job
-    Vector toSave = new DenseVector(vector);
+    Vector toSave = new DenseVector(VECTOR);
     DummyRecordWriter<IntWritable, VectorWritable> writer = new 
       DummyRecordWriter<IntWritable, VectorWritable>();
     Mapper<IntWritable, VectorWritable, IntWritable, VectorWritable>.Context
@@ -54,20 +54,20 @@ public class TestVectorMatrixMultiplicat
     mapper.setup(toSave);
     
     // run the job
-    for (int i = 0; i < matrix.length; i++) {
-      Vector v = new RandomAccessSparseVector(matrix[i].length);
-      v.assign(matrix[i]);
+    for (int i = 0; i < MATRIX.length; i++) {
+      Vector v = new RandomAccessSparseVector(MATRIX[i].length);
+      v.assign(MATRIX[i]);
       mapper.map(new IntWritable(i), new VectorWritable(v), context);
     }
     
     // check the results
-    assertEquals("Number of map results", matrix.length, writer.getData().size());
-    for (int i = 0; i < matrix.length; i++) {
+    assertEquals("Number of map results", MATRIX.length, writer.getData().size());
+    for (int i = 0; i < MATRIX.length; i++) {
       List<VectorWritable> list = writer.getValue(new IntWritable(i));
       assertEquals("Only one vector per key", 1, list.size());
       Vector v = list.get(0).get();
-      for (int j = 0; j < matrix[i].length; j++) {
-        double total = Math.sqrt(vector[i]) * Math.sqrt(vector[j]) * matrix[i][j];
+      for (int j = 0; j < MATRIX[i].length; j++) {
+        double total = Math.sqrt(VECTOR[i]) * Math.sqrt(VECTOR[j]) * MATRIX[i][j];
         assertEquals("Product matrix elements", total, v.get(j),EPSILON);
       }
     }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/eigencuts/TestEigencutsAffinityCutsJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/eigencuts/TestEigencutsAffinityCutsJob.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/eigencuts/TestEigencutsAffinityCutsJob.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/eigencuts/TestEigencutsAffinityCutsJob.java Fri Oct  1 11:00:16 2010
@@ -154,8 +154,8 @@ public class TestEigencutsAffinityCutsJo
       VertexWritable.class);
     
     // perform the combining
-    for (Text key : data.keySet()) {
-      combiner.reduce(key, data.get(key), redContext);
+    for (Map.Entry<Text, List<VertexWritable>> entry : data.entrySet()) {
+      combiner.reduce(entry.getKey(), entry.getValue(), redContext);
     }
     
     // test the number of cuts, there should be 2
@@ -165,9 +165,9 @@ public class TestEigencutsAffinityCutsJo
     // loop through all the results; let's see if they match up to our
     // affinity matrix (and all the cuts appear where they should
     Map<Text, List<VertexWritable>> results = redWriter.getData();
-    for (Text thekey : results.keySet()) {
-      List<VertexWritable> row = results.get(thekey);
-      IntWritable key = new IntWritable(Integer.parseInt(thekey.toString()));
+    for (Map.Entry<Text, List<VertexWritable>> entry : results.entrySet()) {
+      List<VertexWritable> row = entry.getValue();
+      IntWritable key = new IntWritable(Integer.parseInt(entry.getKey().toString()));
       
       double calcDiag = 0.0, trueDiag = sumOfRowCuts(key.get(), this.sensitivity);
       for (VertexWritable e : row) {
@@ -227,8 +227,8 @@ public class TestEigencutsAffinityCutsJo
       VertexWritable.class);
     
     // perform the combining
-    for (Text key : data.keySet()) {
-      combiner.reduce(key, data.get(key), comContext);
+    for (Map.Entry<Text, List<VertexWritable>> entry : data.entrySet()) {
+      combiner.reduce(entry.getKey(), entry.getValue(), comContext);
     }
     
     // finally, set up the reduction writers

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/ep/ThreadedEvolutionaryProcessTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/ep/ThreadedEvolutionaryProcessTest.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/ep/ThreadedEvolutionaryProcessTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/ep/ThreadedEvolutionaryProcessTest.java Fri Oct  1 11:00:16 2010
@@ -26,7 +26,7 @@ public final class ThreadedEvolutionaryP
   @Test
   public void testOptimize() throws ExecutionException, InterruptedException {
     ThreadedEvolutionaryProcess ep = new ThreadedEvolutionaryProcess(50);
-    State<?> x = ep.optimize(new ThreadedEvolutionaryProcess.Function() {
+    ep.optimize(new ThreadedEvolutionaryProcess.Function() {
       /**
        * Implements a skinny quadratic bowl.
        */

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/vectors/MurmurHashTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/vectors/MurmurHashTest.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/vectors/MurmurHashTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/vectors/MurmurHashTest.java Fri Oct  1 11:00:16 2010
@@ -58,8 +58,7 @@ public class MurmurHashTest extends Maho
   @Test
   public void testChangingSeed() {
     // use a fixed key
-    byte[] key = new byte[]{0x4E, (byte) 0xE3, (byte) 0x91, 0x00,
-      0x10, (byte) 0x8F, (byte) 0xFF};
+    byte[] key = {0x4E, (byte) 0xE3, (byte) 0x91, 0x00, 0x10, (byte) 0x8F, (byte) 0xFF};
 
     int[] expected = {0xeef8be32, 0x8109dec6, 0x9aaf4192, 0xc1bcaf1c,
       0x821d2ce4, 0xd45ed1df, 0x6c0357a7, 0x21d4e845,
@@ -109,7 +108,7 @@ public class MurmurHashTest extends Maho
   /**
    * Fill a key with a known pattern (incrementing numbers)
    */
-  private void setKey(byte[] key, int start) {
+  private static void setKey(byte[] key, int start) {
     for (int i = 0; i < key.length; i++) {
       key[i] = (byte) ((start + i) & 0xFF);
     }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayDirichlet.java Fri Oct  1 11:00:16 2010
@@ -79,7 +79,7 @@ public class DisplayDirichlet extends Di
       List<Cluster> clusters = new ArrayList<Cluster>();
       for (Cluster cluster : models) {
         if (isSignificant(cluster)) {
-          clusters.add((Cluster) cluster);
+          clusters.add(cluster);
         }
       }
       CLUSTERS.add(clusters);

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/minhash/LastfmDataConverter.java Fri Oct  1 11:00:16 2010
@@ -123,7 +123,7 @@ public final class LastfmDataConverter {
         features.add(featureIdx);
         parsedRecords++;
         // Update the progress
-        percentDone = (parsedRecords * 100) / totalRecords;
+        percentDone = (parsedRecords * 100.0) / totalRecords;
         msg = usedMemory() + "Converting data to internal vector format: ";
         if (percentDone > prevPercentDone) {
           System.out.print('\r' + msg + percentDone + '%');
@@ -171,7 +171,7 @@ public final class LastfmDataConverter {
         featuresWritable.set(featureVector);
         writer.append(itemWritable, featuresWritable);
         // Update the progress
-        double percentDone = ((++doneRecords) * 100) / totalRecords;
+        double percentDone = ((++doneRecords) * 100.0) / totalRecords;
         if (percentDone > prevPercentDone) {
           System.out.print('\r' + msg + percentDone + "% " + ((percentDone >= 100) ? "Completed\n" : ""));
           prevPercentDone++;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseMatrix.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/DenseMatrix.java Fri Oct  1 11:00:16 2010
@@ -96,6 +96,7 @@ public class DenseMatrix extends Abstrac
     return viewPart(rowOffset, rowsRequested, columnOffset, columnsRequested);
   }
 
+  @Override
   public Matrix viewPart(int rowOffset, int rowsRequested, int columnOffset, int columnsRequested) {
     if (rowOffset < 0) {
       throw new IndexException(rowOffset, rowSize());

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/OrthonormalityVerifier.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/OrthonormalityVerifier.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/OrthonormalityVerifier.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/OrthonormalityVerifier.java Fri Oct  1 11:00:16 2010
@@ -22,7 +22,7 @@ import java.util.List;
 
 public final class OrthonormalityVerifier {
 
-  public OrthonormalityVerifier() {
+  private OrthonormalityVerifier() {
   }
 
   public static VectorIterable pairwiseInnerProducts(Iterable<MatrixSlice> basis) {

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/decomposer/AsyncEigenVerifier.java Fri Oct  1 11:00:16 2010
@@ -37,19 +37,17 @@ public class AsyncEigenVerifier extends 
   }
 
   @Override
-  public EigenStatus verify(VectorIterable corpus, Vector vector) {
-    synchronized (status) {
-      if (!finished && !started) { // not yet started or finished, so start!
-        status = new EigenStatus(-1, 0);
-        Vector vectorCopy = vector.clone();
-        threadPool.execute(new VerifierRunnable(corpus, vectorCopy));
-        started = true;
-      }
-      if (finished) {
-        finished = false;
-      }
-      return status;
+  public synchronized EigenStatus verify(VectorIterable corpus, Vector vector) {
+    if (!finished && !started) { // not yet started or finished, so start!
+      status = new EigenStatus(-1, 0);
+      Vector vectorCopy = vector.clone();
+      threadPool.execute(new VerifierRunnable(corpus, vectorCopy));
+      started = true;
+    }
+    if (finished) {
+      finished = false;
     }
+    return status;
   }
 
   protected EigenStatus innerVerify(VectorIterable corpus, Vector vector) {
@@ -67,7 +65,7 @@ public class AsyncEigenVerifier extends 
 
     public void run() {
       EigenStatus status = innerVerify(corpus, vector);
-      synchronized (AsyncEigenVerifier.this.status) {
+      synchronized (AsyncEigenVerifier.this) {
         AsyncEigenVerifier.this.status = status;
         finished = true;
         started = false;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/sampling/RandomSamplingAssistant.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/sampling/RandomSamplingAssistant.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/sampling/RandomSamplingAssistant.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/sampling/RandomSamplingAssistant.java Fri Oct  1 11:00:16 2010
@@ -54,7 +54,7 @@ public final class RandomSamplingAssista
   }
 
   /** Not yet commented. */
-  protected void fetchNextBlock() {
+  void fetchNextBlock() {
     if (n > 0) {
       long last = buffer[bufferPosition];
       sampler.nextBlock((int) Math.min(n, MAX_BUFFER_SIZE), buffer, 0);

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java Fri Oct  1 11:00:16 2010
@@ -66,7 +66,7 @@ public final class DenseDoubleMatrix2D e
    * @throws IllegalArgumentException if <tt>rows<0 || columns<0 || (double)columns*rows > Integer.MAX_VALUE</tt> or
    *                                  flip's are illegal.
    */
-  protected DenseDoubleMatrix2D(int rows, int columns, double[] elements, int rowZero, int columnZero, int rowStride,
+  DenseDoubleMatrix2D(int rows, int columns, double[] elements, int rowZero, int columnZero, int rowStride,
                                 int columnStride) {
     setUp(rows, columns, rowZero, columnZero, rowStride, columnStride);
     this.elements = elements;

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java Fri Oct  1 11:00:16 2010
@@ -33,7 +33,7 @@ import org.apache.mahout.math.matrix.Dou
 final class SelectedDenseDoubleMatrix2D extends DoubleMatrix2D {
 
   /** The elements of this matrix. */
-  double[] elements;
+  final double[] elements;
 
   /** The offsets of the visible cells of this matrix. */
   private int[] rowOffsets;

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwEvaluator.java Fri Oct  1 11:00:16 2010
@@ -241,16 +241,16 @@ public class CDbwEvaluator {
     stdev /= c;
     // accumulate the summations
     double sumI = 0.0;
-    for (int i = 0; i < clusters.size(); i++) {
-      Integer cI = clusters.get(i).getId();
+    for (Cluster cluster : clusters) {
+      Integer cI = cluster.getId();
       List<VectorWritable> repPtsI = representativePoints.get(cI);
       int r = repPtsI.size();
       double sumJ = 0.0;
-      // compute the term density (eqn 6) 
+      // compute the term density (eqn 6)
       for (int j = 0; j < r; j++) {
         // compute f(x, vIJ) (eqn 7)
         Vector repJ = repPtsI.get(j).get();
-        double densityIJ = (measure.distance(clusters.get(i).getCenter(), repJ) <= stdev ? 1.0 : 0.0);
+        double densityIJ = (measure.distance(cluster.getCenter(), repJ) <= stdev ? 1.0 : 0.0);
         // accumulate sumJ
         sumJ += densityIJ / stdev;
       }
@@ -338,11 +338,11 @@ public class CDbwEvaluator {
           density = minDistance * interDensity / stdSum;
         }
 
-        log.debug("minDistance[" + cI + "," + cJ + "]=" + minDistance);
+        log.debug("minDistance[" + cI + ',' + cJ + "]=" + minDistance);
         log.debug("stDev[" + cI + "]=" + stDevI);
         log.debug("stDev[" + cJ + "]=" + stDevJ);
-        log.debug("interDensity[" + cI + "," + cJ + "]=" + interDensity);
-        log.debug("density[" + cI + "," + cJ + "]=" + density);
+        log.debug("interDensity[" + cI + ',' + cJ + "]=" + interDensity);
+        log.debug("density[" + cI + ',' + cJ + "]=" + density);
 
         sum += density;
       }

Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/evaluation/ClusterEvaluator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/evaluation/ClusterEvaluator.java?rev=1003478&r1=1003477&r2=1003478&view=diff
==============================================================================
--- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/evaluation/ClusterEvaluator.java (original)
+++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/evaluation/ClusterEvaluator.java Fri Oct  1 11:00:16 2010
@@ -201,7 +201,7 @@ public class ClusterEvaluator {
       avgDensity += density;
       log.info("Intra-Cluster Density[" + cluster.getId() + "] = " + density);
     }
-    avgDensity = clusters.size() == 0 ? 0 : avgDensity / clusters.size();
+    avgDensity = clusters.isEmpty() ? 0 : avgDensity / clusters.size();
     log.info("Intra-Cluster Density = " + avgDensity);
     return avgDensity;
 



Mime
View raw message