mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1131421 - in /mahout/trunk: core/src/main/java/org/apache/mahout/cf/taste/hadoop/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/ core/src/main/java/org/apache/mahout/cf/...
Date Sat, 04 Jun 2011 16:03:50 GMT
Author: srowen
Date: Sat Jun  4 16:03:49 2011
New Revision: 1131421

URL: http://svn.apache.org/viewvc?rev=1131421&view=rev
Log:
Style items

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/TasteHadoopUtils.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/TaggedVarIntWritable.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/VectorAndPrefsWritable.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/SimilarItem.java
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/jdbc/AbstractJDBCComponent.java
    mahout/trunk/core/src/main/java/org/apache/mahout/classifier/OnlineLearner.java
    mahout/trunk/core/src/main/java/org/apache/mahout/classifier/naivebayes/trainer/NaiveBayesTrainer.java
    mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/CsvRecordFactory.java
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/DistributionDescription.java
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyCreatorMapper.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/AbstractJob.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterable.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterator.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileIterator.java
    mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileValueIterator.java
    mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java
    mahout/trunk/core/src/main/java/org/apache/mahout/ep/EvolutionaryProcess.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/TimesSquaredJob.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/DistributedLanczosSolver.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/HdfsBackedLanczosState.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/SimilarityMatrixEntryKey.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedOccurrence.java
    mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedRowPair.java
    mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/DefaultAnalyzer.java
    mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/term/TFPartialVectorReducer.java
    mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/common/TopKMinKTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/hadoop/item/RecommenderJobTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/classifier/sgd/ModelSerializerTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/ClusteringTestUtils.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDistributions.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java
    mahout/trunk/core/src/test/java/org/apache/mahout/clustering/spectral/eigencuts/TestEigencutsAffinityCutsJob.java
    mahout/trunk/core/src/test/java/org/apache/mahout/common/AbstractJobTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolver.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java
    mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/LocalSSVDSolverSparseSequentialTest.java
    mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayMeanShift.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java
    mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/io/DelimitedTermInfoWriter.java
    mahout/trunk/math/src/test/java/org/apache/mahout/math/decomposer/SolverTest.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/TasteHadoopUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/TasteHadoopUtils.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/TasteHadoopUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/TasteHadoopUtils.java Sat Jun  4 16:03:49 2011
@@ -23,8 +23,6 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.mapreduce.Job;
-import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
 import org.apache.mahout.common.Pair;
 import org.apache.mahout.common.iterator.sequencefile.PathFilters;
 import org.apache.mahout.common.iterator.sequencefile.PathType;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/ParallelALSFactorizationJob.java Sat Jun  4 16:03:49 2011
@@ -30,7 +30,6 @@ import org.apache.hadoop.mapreduce.Reduc
 import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
 import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
 import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
-import org.apache.hadoop.mapreduce.lib.partition.HashPartitioner;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.mahout.cf.taste.hadoop.TasteHadoopUtils;
 import org.apache.mahout.cf.taste.impl.common.FullRunningAverage;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/TaggedVarIntWritable.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/TaggedVarIntWritable.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/TaggedVarIntWritable.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/TaggedVarIntWritable.java Sat Jun  4 16:03:49 2011
@@ -102,7 +102,7 @@ public class TaggedVarIntWritable implem
     }
 
     protected static int compare(int a, int b) {
-      return (a == b) ? 0 : (a < b) ? -1 : 1;
+      return a == b ? 0 : a < b ? -1 : 1;
     }
   }
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/VectorAndPrefsWritable.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/VectorAndPrefsWritable.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/VectorAndPrefsWritable.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/VectorAndPrefsWritable.java Sat Jun  4 16:03:49 2011
@@ -83,6 +83,6 @@ public final class VectorAndPrefsWritabl
 
   @Override
   public String toString() {
-    return vector + "\t" + userIDs + "\t" + values;
+    return vector + "\t" + userIDs + '\t' + values;
   }
 }
\ No newline at end of file

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/SimilarItem.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/SimilarItem.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/SimilarItem.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/similarity/item/SimilarItem.java Sat Jun  4 16:03:49 2011
@@ -43,7 +43,7 @@ class SimilarItem {
   static class BySimilaritySimilarItemComparator implements Comparator<SimilarItem>, Serializable {
     @Override
     public int compare(SimilarItem s1, SimilarItem s2) {
-      return (s1.similarity == s2.similarity) ? 0 : (s1.similarity < s2.similarity) ? -1 : 1;
+      return s1.similarity == s2.similarity ? 0 : s1.similarity < s2.similarity ? -1 : 1;
     }
   }
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/jdbc/AbstractJDBCComponent.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/jdbc/AbstractJDBCComponent.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/jdbc/AbstractJDBCComponent.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/jdbc/AbstractJDBCComponent.java Sat Jun  4 16:03:49 2011
@@ -22,7 +22,6 @@ import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.sql.DataSource;
 
-import com.google.common.io.Closeables;
 import org.apache.mahout.cf.taste.common.TasteException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/OnlineLearner.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/OnlineLearner.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/OnlineLearner.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/OnlineLearner.java Sat Jun  4 16:03:49 2011
@@ -19,10 +19,12 @@ package org.apache.mahout.classifier;
 
 import org.apache.mahout.math.Vector;
 
+import java.io.Closeable;
+
 /**
  * The simplest interface for online learning algorithms.
  */
-public interface OnlineLearner {
+public interface OnlineLearner extends Closeable {
   /**
    * Updates the model using a particular target variable value and a feature vector.
    * <p/>
@@ -89,5 +91,6 @@ public interface OnlineLearner {
    * An online classifier should be able to accept more training after being closed, but
    * closing the classifier may make classification more efficient.
    */
+  @Override
   void close();
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/naivebayes/trainer/NaiveBayesTrainer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/naivebayes/trainer/NaiveBayesTrainer.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/naivebayes/trainer/NaiveBayesTrainer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/naivebayes/trainer/NaiveBayesTrainer.java Sat Jun  4 16:03:49 2011
@@ -39,8 +39,6 @@ import org.apache.mahout.math.VectorWrit
 
 /**
  * This class trains a Naive Bayes Classifier (Parameters for both Naive Bayes and Complementary Naive Bayes)
- * 
- * 
  */
 public final class NaiveBayesTrainer {
   
@@ -202,8 +200,8 @@ public final class NaiveBayesTrainer {
     Path labelMapPath = new Path(labelMapPathBase, LABEL_MAP);
     
     SequenceFile.Writer dictWriter = new SequenceFile.Writer(fs, conf, labelMapPath, Text.class, IntWritable.class);
-    int i = 0;
     try {
+      int i = 0;
       for (String label : labels) {
         Writable key = new Text(label);
         dictWriter.append(key, new IntWritable(i++));

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/CsvRecordFactory.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/CsvRecordFactory.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/CsvRecordFactory.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/classifier/sgd/CsvRecordFactory.java Sat Jun  4 16:03:49 2011
@@ -202,13 +202,13 @@ public class CsvRecordFactory implements
         predictorEncoders.put(predictor, encoder);
         encoder.setTraceDictionary(traceDictionary);
       } catch (InstantiationException e) {
-        throw new ImpossibleException(CANNOT_CONSTRUCT_CONVERTER, e);
+        throw new IllegalStateException(CANNOT_CONSTRUCT_CONVERTER, e);
       } catch (IllegalAccessException e) {
-        throw new ImpossibleException(CANNOT_CONSTRUCT_CONVERTER, e);
+        throw new IllegalStateException(CANNOT_CONSTRUCT_CONVERTER, e);
       } catch (InvocationTargetException e) {
-        throw new ImpossibleException(CANNOT_CONSTRUCT_CONVERTER, e);
+        throw new IllegalStateException(CANNOT_CONSTRUCT_CONVERTER, e);
       } catch (NoSuchMethodException e) {
-        throw new ImpossibleException(CANNOT_CONSTRUCT_CONVERTER, e);
+        throw new IllegalStateException(CANNOT_CONSTRUCT_CONVERTER, e);
       }
     }
   }
@@ -284,10 +284,4 @@ public class CsvRecordFactory implements
     return r;
   }
 
-  private static final class ImpossibleException extends RuntimeException {
-    private ImpossibleException(String message, Throwable cause) {
-      super(message, cause);
-    }
-  }
-
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java Sat Jun  4 16:03:49 2011
@@ -417,7 +417,7 @@ public class CanopyDriver extends Abstra
         }
       } finally {
         Closeables.closeQuietly(reader);
-        Closeables.closeQuietly(writer);;
+        Closeables.closeQuietly(writer);
       }
     }
   }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/DistributionDescription.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/DistributionDescription.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/DistributionDescription.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/models/DistributionDescription.java Sat Jun  4 16:03:49 2011
@@ -19,7 +19,9 @@ package org.apache.mahout.clustering.dir
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
 
+import com.google.common.base.Splitter;
 import org.apache.mahout.clustering.ModelDistribution;
 import org.apache.mahout.common.distance.DistanceMeasure;
 import org.apache.mahout.math.Vector;
@@ -101,8 +103,12 @@ public final class DistributionDescripti
   }
 
   public static DistributionDescription fromString(String s) {
-    String[] tokens = s.split(",");
-    return new DistributionDescription(tokens[0], tokens[1], tokens[2], Integer.parseInt(tokens[3]));
+    Iterator<String> tokens = Splitter.on(',').split(s).iterator();
+    String modelFactory = tokens.next();
+    String modelPrototype = tokens.next();
+    String distanceMeasure = tokens.next();
+    int prototypeSize = Integer.parseInt(tokens.next());
+    return new DistributionDescription(modelFactory, modelPrototype, distanceMeasure, prototypeSize);
   }
 
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDADriver.java Sat Jun  4 16:03:49 2011
@@ -79,8 +79,6 @@ public final class LDADriver extends Abs
 
   private LDAState state = null;
 
-  private LDAState newState = null;
-
   private LDAInference inference = null;
 
   private Iterable<Pair<Writable, VectorWritable>> trainingCorpus = null;
@@ -178,7 +176,7 @@ public final class LDADriver extends Abs
     return 0;
   }
 
-  private Path getLastKnownStatePath(Configuration conf, Path stateDir) throws IOException {
+  private static Path getLastKnownStatePath(Configuration conf, Path stateDir) throws IOException {
     FileSystem fs = FileSystem.get(conf);
     Path lastPath = null;
     int maxIteration = Integer.MIN_VALUE;
@@ -362,7 +360,7 @@ public final class LDADriver extends Abs
     if (inference == null) {
       inference = new LDAInference(state);
     }
-    newState = createState(conf, true);
+    LDAState newState = createState(conf, true);
     double ll = 0.0;
     for(Pair<Writable, VectorWritable> slice : trainingCorpus) {
       LDAInference.InferredDocument doc;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyCreatorMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyCreatorMapper.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyCreatorMapper.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/meanshift/MeanShiftCanopyCreatorMapper.java Sat Jun  4 16:03:49 2011
@@ -65,7 +65,7 @@ public class MeanShiftCanopyCreatorMappe
           && "attempt".equals(parts[0])
           && ("m".equals(parts[3]) || "r".equals(parts[3])),
           "TaskAttemptId string: %d is not properly formed", taskId);
-      nextCanopyId = ((1 << 31) / 50000) * (Integer.parseInt(parts[4]));
+      nextCanopyId = ((1 << 31) / 50000) * Integer.parseInt(parts[4]);
       //each mapper has 42,949 ids to give.
     }
   }

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -297,7 +297,7 @@ public abstract class AbstractJob extend
     argMap = new TreeMap<String, String>();
     maybePut(argMap, cmdLine, this.options.toArray(new Option[this.options.size()]));
 
-    this.tempPath = new Path(argMap.get("--tempDir").toString());
+    this.tempPath = new Path(argMap.get("--tempDir"));
 
     log.info("Command line arguments: {}", argMap);
     return argMap;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/IOUtils.java Sat Jun  4 16:03:49 2011
@@ -26,7 +26,6 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Collection;
 
-import com.google.common.base.Preconditions;
 import com.google.common.io.Closeables;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterable.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterable.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterable.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterable.java Sat Jun  4 16:03:49 2011
@@ -24,11 +24,6 @@ import java.nio.charset.Charset;
 import java.util.Iterator;
 
 import com.google.common.base.Charsets;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-import org.apache.mahout.cf.taste.impl.common.FastIDSet;
-import org.apache.mahout.common.HadoopUtil;
 
 /**
  * Iterable representing the lines of a text file. It can produce an {@link Iterator} over those lines. This

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterator.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/FileLineIterator.java Sat Jun  4 16:03:49 2011
@@ -32,7 +32,6 @@ import com.google.common.base.Charsets;
 import com.google.common.collect.AbstractIterator;
 import com.google.common.io.Closeables;
 import org.apache.mahout.cf.taste.impl.common.SkippingIterator;
-import org.apache.mahout.common.IOUtils;
 
 /**
  * Iterates over the lines of a text file. This assumes the text file's lines are delimited in a manner

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileIterator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileIterator.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileIterator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileIterator.java Sat Jun  4 16:03:49 2011
@@ -29,7 +29,6 @@ import org.apache.hadoop.io.NullWritable
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.util.ReflectionUtils;
-import org.apache.mahout.common.IOUtils;
 import org.apache.mahout.common.Pair;
 
 /**

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileValueIterator.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileValueIterator.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileValueIterator.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/common/iterator/sequencefile/SequenceFileValueIterator.java Sat Jun  4 16:03:49 2011
@@ -28,7 +28,6 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.SequenceFile;
 import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.util.ReflectionUtils;
-import org.apache.mahout.common.IOUtils;
 
 /**
  * <p>{@link java.util.Iterator} over a {@link SequenceFile}'s values only.</p>

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/df/data/Data.java Sat Jun  4 16:03:49 2011
@@ -294,10 +294,9 @@ public class Data implements Cloneable {
     
     int[] labels = new int[dataset.nbInstances()];
     DataConverter converter = new DataConverter(dataset);
-    
-    int index = 0;
 
     try {
+      int index = 0;
       while (iterator.hasNext()) {
         labels[index++] = converter.convert(0, iterator.next()).getLabel();
       }

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -21,6 +21,7 @@ import com.google.common.collect.Lists;
 import org.apache.hadoop.io.Writable;
 import org.apache.mahout.classifier.sgd.PolymorphicWritable;
 
+import java.io.Closeable;
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
@@ -64,7 +65,7 @@ import java.util.concurrent.Future;
  *
  * @param <T> The payload class.
  */
-public class EvolutionaryProcess<T extends Payload<U>, U> implements Writable {
+public class EvolutionaryProcess<T extends Payload<U>, U> implements Writable, Closeable {
   // used to execute operations on the population in thread parallel.
   private ExecutorService pool;
 
@@ -187,10 +188,11 @@ public class EvolutionaryProcess<T exten
     return population;
   }
 
+  @Override
   public void close() {
     List<Runnable> remainingTasks = pool.shutdownNow();
     if (!remainingTasks.isEmpty()) {
-      throw new EarlyTerminationException("Had to forcefully shut down " + remainingTasks.size() + " tasks");
+      throw new IllegalStateException("Had to forcefully shut down " + remainingTasks.size() + " tasks");
     }
   }
 
@@ -198,12 +200,6 @@ public class EvolutionaryProcess<T exten
     double apply(T payload, double[] params);
   }
 
-  public static class EarlyTerminationException extends RuntimeException {
-    public EarlyTerminationException(String message) {
-      super(message);
-    }
-  }
-
   @Override
   public void write(DataOutput out) throws IOException {
     out.writeInt(threadCount);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/DistributedRowMatrix.java Sat Jun  4 16:03:49 2011
@@ -322,7 +322,7 @@ public class DistributedRowMatrix implem
     
     @Override
     public String toString() {
-      return "(" + row + "," + col + "):" + val;
+      return "(" + row + ',' + col + "):" + val;
     }
   }
 }

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -40,7 +40,6 @@ import org.apache.hadoop.mapred.Sequence
 import org.apache.mahout.common.iterator.sequencefile.SequenceFileValueIterator;
 import org.apache.mahout.math.DenseVector;
 import org.apache.mahout.math.RandomAccessSparseVector;
-import org.apache.mahout.math.SequentialAccessSparseVector;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.VectorWritable;
 import org.apache.mahout.math.function.Functions;
@@ -166,7 +165,7 @@ public final class TimesSquaredJob {
     DistributedCache.setCacheFiles(new URI[] {ivpURI}, conf);
 
     conf.set(INPUT_VECTOR, ivpURI.toString());
-    conf.setBoolean(IS_SPARSE_OUTPUT, !(v.isDense()));
+    conf.setBoolean(IS_SPARSE_OUTPUT, !v.isDense());
     conf.setInt(OUTPUT_VECTOR_DIMENSION, outputVectorDim);
     FileInputFormat.addInputPath(conf, matrixInputPath);
     conf.setInputFormat(SequenceFileInputFormat.class);

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -18,6 +18,7 @@
 package org.apache.mahout.math.hadoop.decomposer;
 
 import com.google.common.io.Closeables;
+import org.apache.hadoop.conf.Configurable;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -66,7 +67,7 @@ public class DistributedLanczosSolver ex
                              int desiredRank,
                              boolean isSymmetric,
                              String outputEigenVectorPathString) throws IOException {
-    ((DistributedRowMatrix)state.getCorpus()).setConf(new Configuration(originalConfig));
+    ((Configurable) state.getCorpus()).setConf(new Configuration(originalConfig));
     setConf(originalConfig);
     solve(state, desiredRank, isSymmetric);
     serializeOutput(state, new Path(outputEigenVectorPathString));

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/HdfsBackedLanczosState.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/HdfsBackedLanczosState.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/HdfsBackedLanczosState.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/decomposer/HdfsBackedLanczosState.java Sat Jun  4 16:03:49 2011
@@ -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.decomposer;
 
 import com.google.common.io.Closeables;
@@ -21,22 +38,24 @@ import java.io.IOException;
 import java.util.Map;
 
 public class HdfsBackedLanczosState extends LanczosState implements Configurable {
+
   private static final Logger log = LoggerFactory.getLogger(HdfsBackedLanczosState.class);
+
   public static final String BASIS_PREFIX = "basis";
   public static final String SINGULAR_PREFIX = "singular";
   public static final String METADATA_FILE = "metadata";
+
   private Configuration conf;
-  private Path baseDir;
-  private Path metadataPath;
-  private Path basisPath;
-  private Path singularVectorPath;
+  private final Path baseDir;
+  private final Path basisPath;
+  private final Path singularVectorPath;
   private FileSystem fs;
   
   public HdfsBackedLanczosState(VectorIterable corpus, int numCols, int desiredRank,
       Vector initialVector, Path dir) {
     super(corpus, numCols, desiredRank, initialVector);
     baseDir = dir;
-    metadataPath = new Path(dir, METADATA_FILE);
+    //Path metadataPath = new Path(dir, METADATA_FILE);
     basisPath = new Path(dir, BASIS_PREFIX);
     singularVectorPath = new Path(dir, SINGULAR_PREFIX);
     if(corpus instanceof Configurable) {
@@ -88,15 +107,15 @@ public class HdfsBackedLanczosState exte
       return;
     }
     int numBasisVectorsOnDisk = 0;
-    Path nextBasisVectorPath = new Path(basisPath, BASIS_PREFIX + "_" + numBasisVectorsOnDisk);
+    Path nextBasisVectorPath = new Path(basisPath, BASIS_PREFIX + '_' + numBasisVectorsOnDisk);
     while(fs.exists(nextBasisVectorPath)) {
-      nextBasisVectorPath = new Path(basisPath, BASIS_PREFIX + "_" + ++numBasisVectorsOnDisk);
+      nextBasisVectorPath = new Path(basisPath, BASIS_PREFIX + '_' + ++numBasisVectorsOnDisk);
     }
-    Vector nextVector = null;
+    Vector nextVector;
     while(numBasisVectorsOnDisk < iterationNumber &&
           (nextVector = getBasisVector(numBasisVectorsOnDisk)) != null) {
       persistVector(nextBasisVectorPath, numBasisVectorsOnDisk, nextVector);
-      nextBasisVectorPath = new Path(basisPath, BASIS_PREFIX + "_" + ++numBasisVectorsOnDisk);
+      nextBasisVectorPath = new Path(basisPath, BASIS_PREFIX + '_' + ++numBasisVectorsOnDisk);
     }
     if(scaleFactor <= 0) {
       scaleFactor = getScaleFactor(); // load from disk if possible
@@ -115,7 +134,7 @@ public class HdfsBackedLanczosState exte
     persistVector(new Path(baseDir, "norms"), 0, norms);
     persistVector(new Path(baseDir, "scaleFactor"), 0, new DenseVector(new double[] {scaleFactor}));
     for(Map.Entry<Integer, Vector> entry : singularVectors.entrySet()) {
-      persistVector(new Path(singularVectorPath, SINGULAR_PREFIX + "_" + entry.getKey()),
+      persistVector(new Path(singularVectorPath, SINGULAR_PREFIX + '_' + entry.getKey()),
           entry.getKey(), entry.getValue());
     }
     super.setIterationNumber(numBasisVectorsOnDisk);
@@ -155,7 +174,7 @@ public class HdfsBackedLanczosState exte
   public Vector getBasisVector(int i) {
     if(!basis.containsKey(i)) {
       try {
-        Vector v = fetchVector(new Path(basisPath, BASIS_PREFIX + "_" + i), i);
+        Vector v = fetchVector(new Path(basisPath, BASIS_PREFIX + '_' + i), i);
         basis.put(i, v);
       } catch (IOException e) {
         log.error("Could not load basis vector: ", i, e);
@@ -168,7 +187,7 @@ public class HdfsBackedLanczosState exte
   public Vector getRightSingularVector(int i) {
     if(!singularVectors.containsKey(i)) {
       try {
-        Vector v = fetchVector(new Path(singularVectorPath, BASIS_PREFIX + "_" + i), i);
+        Vector v = fetchVector(new Path(singularVectorPath, BASIS_PREFIX + '_' + i), i);
         singularVectors.put(i, v);
       } catch (IOException e) {
         log.error("Could not load singular vector: ", i, e);

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/RowSimilarityJob.java Sat Jun  4 16:03:49 2011
@@ -33,7 +33,6 @@ import org.apache.hadoop.mapreduce.Mappe
 import org.apache.hadoop.mapreduce.Reducer;
 import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
 import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
-import org.apache.hadoop.mapreduce.lib.partition.HashPartitioner;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.mahout.common.AbstractJob;
 import org.apache.mahout.math.RandomAccessSparseVector;

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/SimilarityMatrixEntryKey.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/SimilarityMatrixEntryKey.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/SimilarityMatrixEntryKey.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/SimilarityMatrixEntryKey.java Sat Jun  4 16:03:49 2011
@@ -73,7 +73,7 @@ public class SimilarityMatrixEntryKey im
 
   @Override
   public int compareTo(SimilarityMatrixEntryKey other) {
-    return (row == other.row) ? 0 : (row < other.row) ? -1 : 1;
+    return row == other.row ? 0 : row < other.row ? -1 : 1;
   }
 
   @Override
@@ -110,11 +110,11 @@ public class SimilarityMatrixEntryKey im
     }
 
     protected static int compare(long a, long b) {
-      return (a == b) ? 0 : (a < b) ? -1 : 1;
+      return a == b ? 0 : a < b ? -1 : 1;
     }
 
     protected static int compare(double a, double b) {
-      return (a == b) ? 0 : (a < b) ? -1 : 1;
+      return a == b ? 0 : a < b ? -1 : 1;
     }
   }
 

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedOccurrence.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedOccurrence.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedOccurrence.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedOccurrence.java Sat Jun  4 16:03:49 2011
@@ -85,6 +85,6 @@ class WeightedOccurrence implements Writ
   
   @Override
   public String toString() {
-    return row + ":" + value + "(" + weight + ")";
+    return row + ":" + value + '(' + weight + ')';
   }
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedRowPair.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedRowPair.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedRowPair.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/math/hadoop/similarity/WeightedRowPair.java Sat Jun  4 16:03:49 2011
@@ -103,6 +103,6 @@ public class WeightedRowPair implements 
   }
 
   protected static int compare(int a, int b) {
-    return (a == b) ? 0 : (a < b) ? -1 : 1;
+    return a == b ? 0 : a < b ? -1 : 1;
   }
 }

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/DefaultAnalyzer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/DefaultAnalyzer.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/DefaultAnalyzer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/DefaultAnalyzer.java Sat Jun  4 16:03:49 2011
@@ -30,11 +30,7 @@ import java.io.Reader;
  */
 public final class DefaultAnalyzer extends Analyzer {
 
-  private StandardAnalyzer stdAnalyzer = new StandardAnalyzer(Version.LUCENE_31);
-
-  public DefaultAnalyzer() {
-    super();
-  }
+  private final StandardAnalyzer stdAnalyzer = new StandardAnalyzer(Version.LUCENE_31);
 
   @Override
   public TokenStream tokenStream(String fieldName, Reader reader) {

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/term/TFPartialVectorReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/term/TFPartialVectorReducer.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/term/TFPartialVectorReducer.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/term/TFPartialVectorReducer.java Sat Jun  4 16:03:49 2011
@@ -75,7 +75,7 @@ public class TFPartialVectorReducer exte
       ShingleFilter sf = new ShingleFilter(new IteratorTokenStream(value.getEntries().iterator()), maxNGramSize);
       try {
         do {
-          String term = (sf.getAttribute(CharTermAttribute.class)).toString();
+          String term = sf.getAttribute(CharTermAttribute.class).toString();
           if (term.length() > 0 && dictionary.containsKey(term)) { // ngram
             int termId = dictionary.get(term);
             vector.setQuick(termId, vector.getQuick(termId) + 1);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/common/TopKMinKTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/common/TopKMinKTest.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/common/TopKMinKTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/common/TopKMinKTest.java Sat Jun  4 16:03:49 2011
@@ -17,19 +17,19 @@
 
 package org.apache.mahout.cf.taste.common;
 
+import org.apache.mahout.common.MahoutTestCase;
 import org.junit.Test;
 
+import java.io.Serializable;
 import java.util.Comparator;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-
 /**
  * tests for {@link TopK} and {@link MinK}
  */
-public class TopKMinKTest {
+public class TopKMinKTest extends MahoutTestCase {
 
-  static class IntComparator implements Comparator<Integer> {
+  static class IntComparator implements Comparator<Integer>, Serializable {
     @Override
     public int compare(Integer one, Integer two) {
       return one.compareTo(two);
@@ -44,11 +44,11 @@ public class TopKMinKTest {
     }
 
     List<Integer> numbers = topFiveNumbers.retrieve();
-    assertEquals(new Integer(1000000), numbers.get(0));
-    assertEquals(new Integer(999999), numbers.get(1));
-    assertEquals(new Integer(999998), numbers.get(2));
-    assertEquals(new Integer(999997), numbers.get(3));
-    assertEquals(new Integer(999996), numbers.get(4));
+    assertEquals(Integer.valueOf(1000000), numbers.get(0));
+    assertEquals(Integer.valueOf(999999), numbers.get(1));
+    assertEquals(Integer.valueOf(999998), numbers.get(2));
+    assertEquals(Integer.valueOf(999997), numbers.get(3));
+    assertEquals(Integer.valueOf(999996), numbers.get(4));
   }
 
   @Test
@@ -58,7 +58,7 @@ public class TopKMinKTest {
       topFiveNumbers.offer(n);
     }
 
-    assertEquals(new Integer(999996), topFiveNumbers.smallestGreat());
+    assertEquals(Integer.valueOf(999996), topFiveNumbers.smallestGreat());
   }
 
   @Test
@@ -69,11 +69,11 @@ public class TopKMinKTest {
     }
 
     List<Integer> numbers = minFiveNumbers.retrieve();
-    assertEquals(new Integer(1), numbers.get(0));
-    assertEquals(new Integer(2), numbers.get(1));
-    assertEquals(new Integer(3), numbers.get(2));
-    assertEquals(new Integer(4), numbers.get(3));
-    assertEquals(new Integer(5), numbers.get(4));
+    assertEquals(Integer.valueOf(1), numbers.get(0));
+    assertEquals(Integer.valueOf(2), numbers.get(1));
+    assertEquals(Integer.valueOf(3), numbers.get(2));
+    assertEquals(Integer.valueOf(4), numbers.get(3));
+    assertEquals(Integer.valueOf(5), numbers.get(4));
   }
 
   @Test
@@ -83,7 +83,7 @@ public class TopKMinKTest {
       minFiveNumbers.offer(n);
     }
 
-    assertEquals(new Integer(5), minFiveNumbers.greatestSmall());
+    assertEquals(Integer.valueOf(5), minFiveNumbers.greatestSmall());
   }
 
   @Test
@@ -95,9 +95,9 @@ public class TopKMinKTest {
     }
 
     List<Integer> numbers = topThreeNumbers.retrieve();
-    assertEquals(new Integer(1000000), numbers.get(0));
-    assertEquals(new Integer(1000000), numbers.get(1));
-    assertEquals(new Integer(999999), numbers.get(2));
+    assertEquals(Integer.valueOf(1000000), numbers.get(0));
+    assertEquals(Integer.valueOf(1000000), numbers.get(1));
+    assertEquals(Integer.valueOf(999999), numbers.get(2));
   }
 
   @Test
@@ -109,8 +109,8 @@ public class TopKMinKTest {
     }
 
     List<Integer> numbers = minThreeNumbers.retrieve();
-    assertEquals(new Integer(1), numbers.get(0));
-    assertEquals(new Integer(1), numbers.get(1));
-    assertEquals(new Integer(2), numbers.get(2));
+    assertEquals(Integer.valueOf(1), numbers.get(0));
+    assertEquals(Integer.valueOf(1), numbers.get(1));
+    assertEquals(Integer.valueOf(2), numbers.get(2));
   }
 }
\ No newline at end of file

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -246,7 +246,7 @@ public class RecommenderJobTest extends 
       @Override
       public boolean matches(Object argument) {
         if (argument instanceof VectorOrPrefWritable) {
-          VectorOrPrefWritable pref = ((VectorOrPrefWritable) argument);
+          VectorOrPrefWritable pref = (VectorOrPrefWritable) argument;
           return pref.getUserID() == userID && pref.getValue() == prefValue;
         }
         return false;
@@ -323,7 +323,7 @@ public class RecommenderJobTest extends 
       @Override
       public boolean matches(Object argument) {
         if (argument instanceof VectorOrPrefWritable) {
-          VectorOrPrefWritable pref = ((VectorOrPrefWritable) argument);
+          VectorOrPrefWritable pref = (VectorOrPrefWritable) argument;
           return pref.getUserID() == userID && Float.isNaN(pref.getValue());
         }
         return false;
@@ -371,7 +371,7 @@ public class RecommenderJobTest extends 
       @Override
       public boolean matches(Object argument) {
         if (argument instanceof VectorAndPrefsWritable) {
-          VectorAndPrefsWritable vectorAndPrefs = ((VectorAndPrefsWritable) argument);
+          VectorAndPrefsWritable vectorAndPrefs = (VectorAndPrefsWritable) argument;
 
           if (!vectorAndPrefs.getUserIDs().equals(userIDs)) {
             return false;
@@ -643,7 +643,7 @@ public class RecommenderJobTest extends 
       @Override
       public boolean matches(Object argument) {
         if (argument instanceof RecommendedItemsWritable) {
-          RecommendedItemsWritable recommendedItemsWritable = ((RecommendedItemsWritable) argument);
+          RecommendedItemsWritable recommendedItemsWritable = (RecommendedItemsWritable) argument;
           List<RecommendedItem> expectedItems = new LinkedList<RecommendedItem>(Arrays.asList(items));
           return expectedItems.equals(recommendedItemsWritable.getRecommendedItems());
         }

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -17,6 +17,7 @@
 
 package org.apache.mahout.classifier.sgd;
 
+import com.google.common.io.Closeables;
 import org.apache.hadoop.io.Writable;
 import org.apache.mahout.classifier.OnlineLearner;
 import org.apache.mahout.common.MahoutTestCase;
@@ -44,9 +45,8 @@ public final class ModelSerializerTest e
     try {
       PolymorphicWritable.write(dos, m);
     } finally {
-      dos.close();
+      Closeables.closeQuietly(dos);
     }
-
     return PolymorphicWritable.read(new DataInputStream(new ByteArrayInputStream(buf.toByteArray())), clazz);
   }
 

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/ClusteringTestUtils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/ClusteringTestUtils.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/ClusteringTestUtils.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/ClusteringTestUtils.java Sat Jun  4 16:03:49 2011
@@ -50,8 +50,8 @@ public final class ClusteringTestUtils {
                                                          path,
                                                          intWritable ? IntWritable.class : LongWritable.class,
                                                          VectorWritable.class);
-    int recNum = 0;
     try {
+      int recNum = 0;
       for (VectorWritable point : points) {
         writer.append(intWritable ? new IntWritable(recNum++) : new LongWritable(recNum++), point);
       }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/TestClusterInterface.java Sat Jun  4 16:03:49 2011
@@ -18,7 +18,6 @@
 package org.apache.mahout.clustering;
 
 import org.apache.mahout.clustering.canopy.Canopy;
-import org.apache.mahout.clustering.dirichlet.DirichletCluster;
 import org.apache.mahout.clustering.meanshift.MeanShiftCanopy;
 import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.common.distance.DistanceMeasure;

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDistributions.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDistributions.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDistributions.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestDistributions.java Sat Jun  4 16:03:49 2011
@@ -51,7 +51,7 @@ public final class TestDistributions ext
   @Test
   public void testDnorm() {
     for (int i = -30; i < 30; i++) {
-      double d = (i * 0.1);
+      double d = i * 0.1;
       double dnorm = UncommonDistributions.dNorm(d, 0, 1);
       char[] bar = new char[(int) (dnorm * 100)];
       for (int j = 0; j < bar.length; j++) {
@@ -65,7 +65,7 @@ public final class TestDistributions ext
   @Test
   public void testDnorm2() {
     for (int i = -30; i < 30; i++) {
-      double d = (i * 0.1);
+      double d = i * 0.1;
       double dnorm = UncommonDistributions.dNorm(d, 0, 2);
       char[] bar = new char[(int) (dnorm * 100)];
       for (int j = 0; j < bar.length; j++) {
@@ -79,7 +79,7 @@ public final class TestDistributions ext
   @Test
   public void testDnorm1() {
     for (int i = -10; i < 10; i++) {
-      double d = (i * 0.1);
+      double d = i * 0.1;
       double dnorm = UncommonDistributions.dNorm(d, 0, 0.2);
       char[] bar = new char[(int) (dnorm * 100)];
       for (int j = 0; j < bar.length; j++) {

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java Sat Jun  4 16:03:49 2011
@@ -102,7 +102,7 @@ public final class TestMapReduce extends
    *          double standard deviation in y of the samples
    */
   private void generateAsymmetricSamples(int num, double mx, double my, double sdx, double sdy) {
-    System.out.println("Generating " + num + " samples m=[" + mx + ", " + my + "] sd=[" + sdx + ", " + sdy + "]");
+    System.out.println("Generating " + num + " samples m=[" + mx + ", " + my + "] sd=[" + sdx + ", " + sdy + ']');
     for (int i = 0; i < num; i++) {
       addSample(new double[] { UncommonDistributions.rNorm(mx, sdx), UncommonDistributions.rNorm(my, sdy) });
     }

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -169,7 +169,8 @@ public class TestEigencutsAffinityCutsJo
       List<VertexWritable> row = entry.getValue();
       IntWritable key = new IntWritable(Integer.parseInt(entry.getKey().toString()));
       
-      double calcDiag = 0.0, trueDiag = sumOfRowCuts(key.get(), this.sensitivity);
+      double calcDiag = 0.0;
+      double trueDiag = sumOfRowCuts(key.get(), this.sensitivity);
       for (VertexWritable e : row) {
 
         // should the value have been cut, e.g. set to 0?

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/common/AbstractJobTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/common/AbstractJobTest.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/common/AbstractJobTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/common/AbstractJobTest.java Sat Jun  4 16:03:49 2011
@@ -229,6 +229,7 @@ public final class AbstractJobTest exten
         "-Dmapred.output.dir=" + testOutputPropertyPath,
         "--input", testInputPath,
         "--output", testOutputPath });
+    assertEquals("0 for complete options", 0, ret);
     assertEquals("input command-line option precedes property",
         testInputPath, job.getInputPath().toString());
     assertEquals("output command-line option precedes property",

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/df/data/Utils.java Sat Jun  4 16:03:49 2011
@@ -303,7 +303,7 @@ public final class Utils {
   
     for (int partition = 0; partition < numMaps; partition++) {
       int from = partition * partitionSize;
-      int to = (partition == (numMaps - 1)) ? nbInstances : (partition + 1)
+      int to = partition == (numMaps - 1) ? nbInstances : (partition + 1)
           * partitionSize;
   
       splits[partition] = Arrays.copyOfRange(sData, from, to);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/MathHelper.java Sat Jun  4 16:03:49 2011
@@ -55,9 +55,9 @@ public final class MathHelper {
       public boolean matches(Object argument) {
         if (argument instanceof MatrixEntryWritable) {
           MatrixEntryWritable entry = (MatrixEntryWritable) argument;
-          return (row == entry.getRow()
+          return row == entry.getRow()
               && col == entry.getCol()
-              && Math.abs(value - entry.getVal()) <= MahoutTestCase.EPSILON);
+              && Math.abs(value - entry.getVal()) <= MahoutTestCase.EPSILON;
         }
         return false;
       }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/TestDistributedRowMatrix.java Sat Jun  4 16:03:49 2011
@@ -275,13 +275,13 @@ public final class TestDistributedRowMat
     assertEquals(0.0, result1.getDistanceSquared(result2), EPSILON);
   }
 
-  public Configuration createInitialConf() {
+  public static Configuration createInitialConf() {
     Configuration initialConf = new Configuration();
     initialConf.set(TEST_PROPERTY_KEY, TEST_PROPERTY_VALUE);
     return initialConf;
   }
-  
-  private void deleteContentsOfPath(Configuration conf, Path path) throws Exception {
+
+  private static void deleteContentsOfPath(Configuration conf, Path path) throws Exception {
     FileSystem fs = path.getFileSystem(conf);
     
     FileStatus[] statuses = fs.listStatus(path);

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolver.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolver.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolver.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolver.java Sat Jun  4 16:03:49 2011
@@ -18,8 +18,8 @@
 package org.apache.mahout.math.hadoop.decomposer;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.mahout.common.MahoutTestCase;
 import org.apache.mahout.math.Vector;
 import org.apache.mahout.math.decomposer.SolverTest;
 import org.apache.mahout.math.decomposer.lanczos.LanczosState;
@@ -31,44 +31,27 @@ import org.junit.Test;
 import java.io.File;
 import java.io.IOException;
 
-public final class TestDistributedLanczosSolver extends SolverTest {
-  private Path testTempDirPath = null;
-  int counter = 0;
-  File symTestData;
-  File asymTestData;
-  DistributedRowMatrix symCorpus;
-  DistributedRowMatrix asymCorpus;
+public final class TestDistributedLanczosSolver extends MahoutTestCase {
+
+  private int counter = 0;
+  private DistributedRowMatrix symCorpus;
+  private DistributedRowMatrix asymCorpus;
 
   @Before
   public void setup() throws Exception {
-    symTestData = getTestTempDir("symTestData");
-    asymTestData = getTestTempDir("asymTestData");
+    File symTestData = getTestTempDir("symTestData");
+    File asymTestData = getTestTempDir("asymTestData");
     symCorpus = new TestDistributedRowMatrix().randomDistributedMatrix(500,
         450, 400, 10, 10.0, true, symTestData.getAbsolutePath());
     asymCorpus = new TestDistributedRowMatrix().randomDistributedMatrix(500,
         450, 400, 10, 10.0, false, asymTestData.getAbsolutePath());
   }
 
-  protected final Path getTestTempDirPath() throws IOException {
-    FileSystem fs = null;
-    if (testTempDirPath == null) {
-      fs = FileSystem.get(new Configuration());
-      long simpleRandomLong = (long) (Long.MAX_VALUE * Math.random());
-      testTempDirPath = fs.makeQualified(
-          new Path("/tmp/mahout-" + getClass().getSimpleName() + '-' + simpleRandomLong));
-      if (!fs.mkdirs(testTempDirPath)) {
-        throw new IOException("Could not create " + testTempDirPath);
-      }
-      fs.deleteOnExit(testTempDirPath);
-    }
-    return testTempDirPath;
-  }
-
-  private String suf(boolean symmetric) {
-    return (symmetric ? "_sym" : "_asym");
+  private static String suf(boolean symmetric) {
+    return symmetric ? "_sym" : "_asym";
   }
 
-  private DistributedRowMatrix getCorpus(boolean symmetric) throws IOException {
+  private DistributedRowMatrix getCorpus(boolean symmetric) {
     return symmetric ? symCorpus : asymCorpus;
   }
 
@@ -96,9 +79,9 @@ public final class TestDistributedLanczo
       state = new LanczosState(corpus, corpus.numCols(), desiredRank, intitialVector);
     }
     solver.solve(state, desiredRank, symmetric);
-    assertOrthonormal(state);
+    SolverTest.assertOrthonormal(state);
     for(int i = 0; i < desiredRank/2; i++) {
-      assertEigen(i, state.getRightSingularVector(i), corpus, 0.1, symmetric);
+      SolverTest.assertEigen(i, state.getRightSingularVector(i), corpus, 0.1, symmetric);
     }
     counter++;
     return state;

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/decomposer/TestDistributedLanczosSolverCLI.java Sat Jun  4 16:03:49 2011
@@ -135,7 +135,7 @@ public final class TestDistributedLanczo
       NamedVector v = (NamedVector) value.get();
       eigenVectors.assignRow(i, v);
       log.info(v.getName());
-      if(EigenVector.getCosAngleError(v.getName()) < 1e-3) {
+      if(EigenVector.getCosAngleError(v.getName()) < 1.0e-3) {
         eigenvalues.add(EigenVector.getEigenValue(v.getName()));
       }
       i++;

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/LocalSSVDSolverSparseSequentialTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/LocalSSVDSolverSparseSequentialTest.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/LocalSSVDSolverSparseSequentialTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/math/hadoop/stochasticsvd/LocalSSVDSolverSparseSequentialTest.java Sat Jun  4 16:03:49 2011
@@ -78,14 +78,13 @@ public class LocalSSVDSolverSparseSequen
     closeables.addFirst(w);
 
     int n = 100;
-    Vector dv;
     VectorWritable vw = new VectorWritable();
     IntWritable roww = new IntWritable();
 
     double muAmplitude = 50.0;
     int m = 1000;
     for (int i = 0; i < m; i++) {
-      dv=new SequentialAccessSparseVector(n);
+      Vector dv = new SequentialAccessSparseVector(n);
       for (int j = 0; j < n / 5; j++) {
         dv.setQuick(rnd.nextInt(n), muAmplitude * (rnd.nextDouble() - 0.5));
       }

Modified: mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java (original)
+++ mahout/trunk/core/src/test/java/org/apache/mahout/vectorizer/DocumentProcessorTest.java Sat Jun  4 16:03:49 2011
@@ -44,13 +44,13 @@ public class DocumentProcessorTest exten
     Path output = new Path(getTestTempDirPath(), "outputDir");
 
     String documentId1 = "123";
-    String text1 = "A test for the document processor";
     String documentId2 = "456";
-    String text2 = "and another one";
 
     SequenceFile.Writer writer = new SequenceFile.Writer(fs, configuration, input, Text.class, Text.class);
     try {
+      String text1 = "A test for the document processor";
       writer.append(new Text(documentId1), new Text(text1));
+      String text2 = "and another one";
       writer.append(new Text(documentId2), new Text(text2));
     } finally {
       Closeables.closeQuietly(writer);

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/sgd/SimpleCsvExamples.java Sat Jun  4 16:03:49 2011
@@ -275,7 +275,7 @@ public final class SimpleCsvExamples {
     }
 
     @Override
-    public void close() throws IOException {
+    public void close() {
       Closeables.closeQuietly(in);
     }
   }

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayMeanShift.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayMeanShift.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayMeanShift.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/display/DisplayMeanShift.java Sat Jun  4 16:03:49 2011
@@ -107,7 +107,7 @@ public class DisplayMeanShift extends Di
     writeSampleData(samples);
     //boolean b = true;
     //if (b) {
-    new MeanShiftCanopyDriver().run(conf, samples, output, measure, t1, t2, 0.005, 20, false, true, true);
+    MeanShiftCanopyDriver.run(conf, samples, output, measure, t1, t2, 0.005, 20, false, true, true);
     loadClusters(output);
     //} else {
     //  Collection<Vector> points = new ArrayList<Vector>();

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/fuzzykmeans/Job.java Sat Jun  4 16:03:49 2011
@@ -60,7 +60,7 @@ public final class Job extends AbstractJ
       Path output = new Path("output");
       Configuration conf = new Configuration();
       HadoopUtil.delete(conf, output);
-      new Job().run(conf, new Path("testdata"), output,
+      run(conf, new Path("testdata"), output,
           new EuclideanDistanceMeasure(), 80, 55, 10, (float) 2, 0.5);
     }
   }
@@ -160,11 +160,16 @@ public final class Job extends AbstractJ
    * @throws IllegalAccessException
    * @throws InstantiationException
    */
-  public void run(Configuration conf, Path input, Path output,
-      DistanceMeasure measure, double t1, double t2, int maxIterations,
-      float fuzziness, double convergenceDelta) throws IOException,
-      InterruptedException, ClassNotFoundException, InstantiationException,
-      IllegalAccessException {
+  public static void run(Configuration conf,
+                         Path input,
+                         Path output,
+                         DistanceMeasure measure,
+                         double t1,
+                         double t2,
+                         int maxIterations,
+                         float fuzziness,
+                         double convergenceDelta)
+    throws IOException, InterruptedException, ClassNotFoundException, InstantiationException, IllegalAccessException {
     Path directoryContainingConvertedInput = new Path(output,
         DIRECTORY_CONTAINING_CONVERTED_INPUT);
     log.info("Preparing Input");

Modified: mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java (original)
+++ mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java Sat Jun  4 16:03:49 2011
@@ -130,16 +130,17 @@ public final class Job extends AbstractJ
     throws IOException, InterruptedException, ClassNotFoundException {
     Path directoryContainingConvertedInput = new Path(output, DIRECTORY_CONTAINING_CONVERTED_INPUT);
     InputDriver.runJob(input, directoryContainingConvertedInput);
-    new MeanShiftCanopyDriver().run(conf,
-                                    directoryContainingConvertedInput,
-                                    output,
-                                    measure,
-                                    t1,
-                                    t2,
-                                    convergenceDelta,
-                                    maxIterations,
-                                    true,
-                                    true, false);
+    MeanShiftCanopyDriver.run(conf,
+                              directoryContainingConvertedInput,
+                              output,
+                              measure,
+                              t1,
+                              t2,
+                              convergenceDelta,
+                              maxIterations,
+                              true,
+                              true,
+                              false);
     // run ClusterDumper
     ClusterDumper clusterDumper =
         new ClusterDumper(new Path(output, "clusters-" + maxIterations), new Path(output, "clusteredPoints"));

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/io/DelimitedTermInfoWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/io/DelimitedTermInfoWriter.java?rev=1131421&r1=1131420&r2=1131421&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/io/DelimitedTermInfoWriter.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/vectors/io/DelimitedTermInfoWriter.java Sat Jun  4 16:03:49 2011
@@ -1,4 +1,5 @@
-/**
+/*
+ * 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

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=1131421&r1=1131420&r2=1131421&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 Sat Jun  4 16:03:49 2011
@@ -35,7 +35,7 @@ import java.util.List;
 import java.util.Random;
 
 public abstract class SolverTest extends MahoutTestCase {
-  private static Logger log = LoggerFactory.getLogger(SolverTest.class);
+  private static final Logger log = LoggerFactory.getLogger(SolverTest.class);
 
   public static void assertOrthonormal(Matrix eigens) {
     assertOrthonormal(eigens, 1.0e-6);
@@ -52,11 +52,11 @@ public abstract class SolverTest extends
         }
         double dot = ei.dot(ej);
         if (i == j) {
-          assertTrue("not norm 1 : " + dot + " (eigen #" + i + ')', (Math.abs(1 - dot) < errorMargin));
+          assertTrue("not norm 1 : " + dot + " (eigen #" + i + ')', Math.abs(1.0 - dot) < errorMargin);
         } else {
           if(Math.abs(dot) > errorMargin) {
             log.info("not orthogonal : " + dot + " (eigens " + i + ", " + j + ')', Math.abs(dot) < errorMargin);
-            nonOrthogonals.add("(" + i + "," + j + ")");
+            nonOrthogonals.add("(" + i + ',' + j + ')');
           }
         }
       }
@@ -65,7 +65,7 @@ public abstract class SolverTest extends
   }
 
   public static void assertOrthonormal(LanczosState state) {
-    double errorMargin = 1e-5;
+    double errorMargin = 1.0e-5;
     List<String> nonOrthogonals = new ArrayList<String>();
     for (int i = 0; i < state.getIterationNumber(); i++) {
       Vector ei = state.getRightSingularVector(i);
@@ -76,16 +76,17 @@ public abstract class SolverTest extends
         }
         double dot = ei.dot(ej);
         if (i == j) {
-          assertTrue("not norm 1 : " + dot + " (eigen #" + i + ')', (Math.abs(1 - dot) < errorMargin));
+          assertTrue("not norm 1 : " + dot + " (eigen #" + i + ')', Math.abs(1.0 - dot) < errorMargin);
         } else {
           if(Math.abs(dot) > errorMargin) {
             log.info("not orthogonal : " + dot + " (eigens " + i + ", " + j + ')', Math.abs(dot) < errorMargin);
-            nonOrthogonals.add("(" + i + "," + j + ")");
+            nonOrthogonals.add("(" + i + ',' + j + ')');
           }
         }
       }
-      if(!nonOrthogonals.isEmpty())
+      if (!nonOrthogonals.isEmpty()) {
         log.info(nonOrthogonals.size() + ": " + nonOrthogonals.toString());
+      }
     }
   }
 
@@ -126,7 +127,7 @@ public abstract class SolverTest extends
                                                           int numCols,
                                                           int entriesPerRow,
                                                           double entryMean) {
-    SparseRowMatrix m = new SparseRowMatrix(new int[]{numRows, numCols});
+    Matrix m = new SparseRowMatrix(new int[]{numRows, numCols});
     //double n = 0;
     //Random r = RandomUtils.getRandom();
     Random r = new Random(1234L);
@@ -152,7 +153,7 @@ public abstract class SolverTest extends
   }
 
   public static Matrix randomHierarchicalMatrix(int numRows, int numCols, boolean symmetric) {
-    DenseMatrix matrix = new DenseMatrix(numRows, numCols);
+    Matrix matrix = new DenseMatrix(numRows, numCols);
     Random r = new Random(1234L);
     for(int row = 0; row < numRows; row++) {
       Vector v = new DenseVector(numCols);



Mime
View raw message