mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r826208 - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/cf/taste/hadoop/ main/java/org/apache/mahout/cf/taste/impl/common/ main/java/org/apache/mahout/cf/taste/impl/model/file/ main/java/org/apache/mahout/cf/taste/impl/model...
Date Sat, 17 Oct 2009 09:42:32 GMT
Author: srowen
Date: Sat Oct 17 09:42:31 2009
New Revision: 826208

URL: http://svn.apache.org/viewvc?rev=826208&view=rev
Log:
More small code changes from code analysis

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOneDiffsToAveragesJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOnePrefsToDiffsJob.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/LongPrimitiveArrayIterator.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/Classify.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/HBaseBayesDatastore.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierMapper.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerReducer.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfDriver.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfReducer.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesWeightSummerReducer.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/JobExecutor.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/Canopy.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/TimingStatistics.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/SquaredEuclideanDistanceMeasure.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/TanimotoDistanceMeasure.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapred/partial/PartialBuilder.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/node/Leaf.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseColumnMatrix.java
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseRowMatrix.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/SpearmanCorrelationSimilarityTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/VisibleCanopy.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestLDAInference.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestMapReduce.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/distance/DefaultDistanceMeasureTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialSequentialBuilder.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapreduce/partial/Step0JobTest.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOneDiffsToAveragesJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOneDiffsToAveragesJob.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOneDiffsToAveragesJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOneDiffsToAveragesJob.java Sat Oct 17 09:42:31 2009
@@ -46,7 +46,7 @@
 public final class SlopeOneDiffsToAveragesJob extends Job {
 
   /** Logger for this class. */
-  private static Logger log = Logger.getLogger(SlopeOneDiffsToAveragesJob.class);
+  private static final Logger log = Logger.getLogger(SlopeOneDiffsToAveragesJob.class);
 
   private SlopeOneDiffsToAveragesJob(Configuration jobConf) throws IOException {
     super(jobConf);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOnePrefsToDiffsJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOnePrefsToDiffsJob.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOnePrefsToDiffsJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/hadoop/SlopeOnePrefsToDiffsJob.java Sat Oct 17 09:42:31 2009
@@ -47,7 +47,7 @@
 public final class SlopeOnePrefsToDiffsJob extends Job {
 
   /** Logger for this class.*/
-  private static Logger log = Logger.getLogger(SlopeOnePrefsToDiffsJob.class);
+  private static final Logger log = Logger.getLogger(SlopeOnePrefsToDiffsJob.class);
 
   private SlopeOnePrefsToDiffsJob(Configuration jobConf) throws IOException {
     super(jobConf);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/LongPrimitiveArrayIterator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/LongPrimitiveArrayIterator.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/LongPrimitiveArrayIterator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/common/LongPrimitiveArrayIterator.java Sat Oct 17 09:42:31 2009
@@ -23,7 +23,7 @@
  * While long[] is an Iterable, it is not an Iterable<Long>. This adapter class
  * addresses that.
  */
-public final class LongPrimitiveArrayIterator implements LongPrimitiveIterator, SkippingIterator<Long> {
+public final class LongPrimitiveArrayIterator implements LongPrimitiveIterator {
 
   private final long[] array;
   private int position;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java Sat Oct 17 09:42:31 2009
@@ -222,7 +222,7 @@
       if (line.length() > 0) {
         processLine(line, data, delimiter);
         int currentCount = count.incrementAndGet();
-        if (currentCount % 100000 == 0) {
+        if (currentCount % 1000000 == 0) {
           log.info("Processed {} lines", currentCount);
         }
       }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/jdbc/AbstractJDBCDataModel.java Sat Oct 17 09:42:31 2009
@@ -618,7 +618,7 @@
    * only release database resources after {@link #hasNext()} has been called and has returned <code>false</code>;
    * callers should make sure to "drain" the entire set of data to avoid tying up database resources.</p>
    */
-  private final class ResultSetIDIterator implements LongPrimitiveIterator, SkippingIterator<Long> {
+  private final class ResultSetIDIterator implements LongPrimitiveIterator {
 
     private final Connection connection;
     private final Statement statement;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/Classify.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/Classify.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/Classify.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/Classify.java Sat Oct 17 09:42:31 2009
@@ -141,8 +141,8 @@
 
     log.info("Loading model from: {}", params.print());
 
-    Algorithm algorithm = null;
-    Datastore datastore = null;
+    Algorithm algorithm;
+    Datastore datastore;
 
     String classifierType = (String) cmdLine.getValue(typeOpt);
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/HBaseBayesDatastore.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/HBaseBayesDatastore.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/HBaseBayesDatastore.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/HBaseBayesDatastore.java Sat Oct 17 09:42:31 2009
@@ -76,9 +76,9 @@
           BayesConstants.LABEL_THETA_NORMALIZER, label)));
     }
     for (String label : labels) {
-      System.out.println(label + " "
+      System.out.println(label + ' '
           + getWeightFromHbase(BayesConstants.LABEL_THETA_NORMALIZER, label)
-          + " " + thetaNormalizer + " "
+          + ' ' + thetaNormalizer + ' '
           + getWeightFromHbase(BayesConstants.LABEL_THETA_NORMALIZER, label)
           / thetaNormalizer);
     }
@@ -91,7 +91,7 @@
       throws InvalidDatastoreException {
     if (keys.containsKey(name))
       return keys.get(name);
-    Result r = null;
+    Result r;
     if (name.equals("labelWeight")) {
       r = getRowFromHbase(BayesConstants.LABEL_SUM);
     } else if (name.equals("thetaNormalizer")) {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/datastore/InMemoryBayesDatastore.java Sat Oct 17 09:42:31 2009
@@ -72,8 +72,8 @@
           "thetaNormalizer", label)));
     }
     for (String label : labels) {
-      System.out.println( label + " " +vectorGetCell(
-          "thetaNormalizer", label) +" " +thetaNormalizer + " " + vectorGetCell(
+      System.out.println( label + ' ' +vectorGetCell(
+          "thetaNormalizer", label) + ' ' +thetaNormalizer + ' ' + vectorGetCell(
           "thetaNormalizer", label)/thetaNormalizer);
     }
   }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierDriver.java Sat Oct 17 09:42:31 2009
@@ -85,7 +85,8 @@
     log.info("{}",matrix.summarize());
   }
 
-  private static final ConfusionMatrix readResult(FileSystem fs, Path pathPattern, Configuration conf, BayesParameters params) throws IOException{
+  private static ConfusionMatrix readResult(FileSystem fs, Path pathPattern, Configuration conf, BayesParameters params)
+      throws IOException {
    
     StringTuple key = new StringTuple();
     DoubleWritable value = new DoubleWritable();

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierMapper.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierMapper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesClassifierMapper.java Sat Oct 17 09:42:31 2009
@@ -28,7 +28,6 @@
 import org.apache.mahout.classifier.ClassifierResult;
 import org.apache.mahout.classifier.bayes.algorithm.BayesAlgorithm;
 import org.apache.mahout.classifier.bayes.algorithm.CBayesAlgorithm;
-import org.apache.mahout.classifier.bayes.common.BayesParameters;
 import org.apache.mahout.classifier.bayes.datastore.HBaseBayesDatastore;
 import org.apache.mahout.classifier.bayes.datastore.InMemoryBayesDatastore;
 import org.apache.mahout.classifier.bayes.exceptions.InvalidDatastoreException;
@@ -98,10 +97,10 @@
   public void configure(JobConf job) {
     try {
       log.info("Bayes Parameter" + job.get("bayes.parameters"));
-      Parameters params = BayesParameters.fromString(job.get("bayes.parameters",""));
+      Parameters params = Parameters.fromString(job.get("bayes.parameters", ""));
       log.info("{}", params.print());
-      Algorithm algorithm = null;
-      Datastore datastore = null;
+      Algorithm algorithm;
+      Datastore datastore;
 
       
       if (params.get("dataSource").equals("hdfs")) {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerMapper.java Sat Oct 17 09:42:31 2009
@@ -42,7 +42,8 @@
   private Map<String, Double> labelWeightSum = null;
   private double sigma_jSigma_k = 0.0;
   private double vocabCount = 0.0;
-  private double alpha_i = 1.0;    
+  //private final double alpha_i = 1.0;
+
   /**
    * We need to calculate the thetaNormalization factor of each label
    *

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerReducer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerReducer.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerReducer.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/bayes/BayesThetaNormalizerReducer.java Sat Oct 17 09:42:31 2009
@@ -47,8 +47,6 @@
 
   private HTable table;
 
-  private HBaseConfiguration HBconf;
-
   boolean useHbase = false;
 
   @Override
@@ -91,7 +89,7 @@
       else
         return;
 
-      HBconf = new HBaseConfiguration(job);
+      HBaseConfiguration HBconf = new HBaseConfiguration(job);
       table = new HTable(HBconf, job.get("output.table"));
     } catch (IOException e) {
       log.error("Unexpected error during configuration", e);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureDriver.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesFeatureDriver.java Sat Oct 17 09:42:31 2009
@@ -20,7 +20,6 @@
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.DoubleWritable;
-import org.apache.hadoop.io.Text;
 import org.apache.hadoop.mapred.FileInputFormat;
 import org.apache.hadoop.mapred.FileOutputFormat;
 import org.apache.hadoop.mapred.JobClient;

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfDriver.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfDriver.java Sat Oct 17 09:42:31 2009
@@ -108,7 +108,7 @@
     if (params.get("dataSource").equals("hbase")) {
       HBaseConfiguration hc = new HBaseConfiguration(new Configuration());
       HTableDescriptor ht = new HTableDescriptor(output);
-      HColumnDescriptor hcd = new HColumnDescriptor(BayesConstants.HBASE_COLUMN_FAMILY+":");
+      HColumnDescriptor hcd = new HColumnDescriptor(BayesConstants.HBASE_COLUMN_FAMILY+ ':');
       hcd.setBloomfilter(true);
       hcd.setInMemory(true);
       hcd.setMaxVersions(1);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfMapper.java Sat Oct 17 09:42:31 2009
@@ -41,10 +41,10 @@
 
   private Map<String, Double> labelDocumentCounts = null;
 
-  private static StringTuple vocabCount = new StringTuple(
+  private static final StringTuple vocabCount = new StringTuple(
       BayesConstants.FEATURE_SET_SIZE);
 
-  private static DoubleWritable one = new DoubleWritable(1.0d);
+  private static final DoubleWritable one = new DoubleWritable(1.0);
 
   /**
    * We need to calculate the Tf-Idf of each feature in each label

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfReducer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfReducer.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfReducer.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesTfIdfReducer.java Sat Oct 17 09:42:31 2009
@@ -46,9 +46,6 @@
       .getLogger(BayesTfIdfReducer.class);
 
   private HTable table;
-  private HBaseConfiguration HBconf; //reloading configuration causes 
-                                     //a new htable session to get 
-                                     //created(from HBASE IRC)
   
   boolean useHbase = false;
 
@@ -112,7 +109,7 @@
       else
         return;
 
-      HBconf = new HBaseConfiguration(job);
+      HBaseConfiguration HBconf = new HBaseConfiguration(job);
 
       table = new HTable(HBconf, job.get("output.table"));
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesWeightSummerReducer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesWeightSummerReducer.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesWeightSummerReducer.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/BayesWeightSummerReducer.java Sat Oct 17 09:42:31 2009
@@ -59,7 +59,7 @@
       sum += values.next().get();
     }
     reporter.setStatus("Bayes Weight Summer Reducer: " + key + " => " + sum);
-    char firstChar = key.toString().charAt(0);
+    //char firstChar = key.toString().charAt(0);
     if (useHbase) {
       if (key.stringAt(0).equals(BayesConstants.FEATURE_SUM)) { // sum of weight
         // for all

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/JobExecutor.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/JobExecutor.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/JobExecutor.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/mapreduce/common/JobExecutor.java Sat Oct 17 09:42:31 2009
@@ -35,6 +35,9 @@
   /** Logger for this class. */
   private static final Logger log = LoggerFactory.getLogger(BayesDriver.class);
 
+  private JobExecutor() {
+  }
+
   /**
    * Execute a bayes classification job. Input and output path are parsed from
    * the input parameters.

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/Canopy.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/Canopy.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/Canopy.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/Canopy.java Sat Oct 17 09:42:31 2009
@@ -18,7 +18,6 @@
 package org.apache.mahout.clustering.canopy;
 
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.mahout.clustering.ClusterBase;
@@ -36,7 +35,7 @@
  * application of some distance metric, and a point total which is the sum of all the points and is used to compute the
  * centroid when needed.
  */
-public class Canopy extends ClusterBase implements Writable {
+public class Canopy extends ClusterBase {
 
   // keys used by Driver, Mapper, Combiner & Reducer
   public static final String DISTANCE_MEASURE_KEY = "org.apache.mahout.clustering.canopy.measure";

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/Cluster.java Sat Oct 17 09:42:31 2009
@@ -17,7 +17,6 @@
 package org.apache.mahout.clustering.kmeans;
 
 import org.apache.hadoop.io.Text;
-import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.mapred.JobConf;
 import org.apache.hadoop.mapred.OutputCollector;
 import org.apache.mahout.clustering.ClusterBase;
@@ -31,7 +30,7 @@
 import java.io.IOException;
 import java.util.List;
 
-public class Cluster extends ClusterBase implements Writable {
+public class Cluster extends ClusterBase {
 
   private static final String ERROR_UNKNOWN_CLUSTER_FORMAT="Unknown cluster format:\n";
     
@@ -86,7 +85,6 @@
    */
   public static Cluster decodeCluster(String formattedString) {
     final int beginIndex = formattedString.indexOf('{');
-    final Cluster cluster;
     if (beginIndex <= 0) {
       throw new IllegalArgumentException(ERROR_UNKNOWN_CLUSTER_FORMAT + formattedString);
     }
@@ -94,6 +92,7 @@
     final String center = formattedString.substring(beginIndex);
     final char firstChar = id.charAt(0);
     final boolean startsWithV = firstChar == 'V';
+    final Cluster cluster;
     if (firstChar == 'C' || startsWithV) {
       final int clusterId = Integer.parseInt(formattedString.substring(1,
         beginIndex - 2));

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/StringTuple.java Sat Oct 17 09:42:31 2009
@@ -21,20 +21,16 @@
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.io.Writable;
 import org.apache.hadoop.io.WritableComparable;
 
 /**
  * An Ordered List of Strings which can be used in a Hadoop Map/Reduce Job
- * 
- * 
  */
-public class StringTuple implements Writable, WritableComparable<StringTuple> {
+public final class StringTuple implements WritableComparable<StringTuple> {
 
   private List<String> tuple = new ArrayList<String>();
 
@@ -45,14 +41,16 @@
     add(firstEntry);
   }
   
-  public StringTuple(Collection<String> entries) {
-    for(String entry: entries)
+  public StringTuple(Iterable<String> entries) {
+    for (String entry : entries) {
       add(entry);
+    }
   }
-  
+
   public StringTuple(String[] entries) {
-    for(String entry: entries)
+    for (String entry : entries) {
       add(entry);
+    }
   }
 
   /**
@@ -107,7 +105,7 @@
   @Override
   public String toString() {
     return tuple.toString();
-  };
+  }
 
   @Override
   public int hashCode() {
@@ -155,14 +153,22 @@
 
   @Override
   public int compareTo(StringTuple otherTuple) {
-    int min = Math.min(this.length(), otherTuple.length());
+    int thisLength = length();
+    int otherLength = otherTuple.length();
+    int min = Math.min(thisLength, otherLength);
     for (int i = 0; i < min; i++) {
       int ret = this.tuple.get(i).compareTo(otherTuple.stringAt(i));
-      if (ret == 0)
-        continue;
-      return ret;
+      if (ret != 0) {
+        return ret;
+      }
+    }
+    if (thisLength < otherLength) {
+      return -1;
+    } else if (thisLength > otherLength) {
+      return 1;
+    } else {
+      return 0;
     }
-    return this.length() - otherTuple.length();
   }
 
 }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/TimingStatistics.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/TimingStatistics.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/TimingStatistics.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/TimingStatistics.java Sat Oct 17 09:42:31 2009
@@ -19,95 +19,95 @@
 
 import java.io.Serializable;
 
-public class TimingStatistics implements Serializable {
-    private int nCalls;
-    private long minTime;
-    private long maxTime;
-    private long sumTime;
-    private double sumSquaredTime;
-    
-    /** Creates a new instance of CallStats */
-    public TimingStatistics() {
-    }
+public final class TimingStatistics implements Serializable {
 
-    public TimingStatistics(int nCalls, long minTime, long maxTime, long sumTime,
-                     double sumSquaredTime) {
-        this.nCalls = nCalls;
-        this.minTime = minTime;
-        this.maxTime = maxTime;
-        this.sumTime = sumTime;
-        this.sumSquaredTime = sumSquaredTime;
-    }
-    
-    public int getNCalls() {
-        return nCalls;
-    }
-    
-    public long getMinTime() {
-        return Math.max(0, minTime);
-    }
-    
-    public long getMaxTime() {
-        return maxTime;
-    }
-    
-    public long getSumTime() {
-        return sumTime;
-    }
-    
-    public double getSumSquaredTime() {
-        return sumSquaredTime;
-    }
-    
-    public long getMeanTime() {
-        if (nCalls == 0)
-            return 0;
-        else
-            return sumTime / nCalls;
-    }
-    
-    public long getStdDevTime() {
-        if (nCalls == 0)
-            return 0;
-        double mean = getMeanTime();
-        double meanSquared = mean * mean;
-        double meanOfSquares = sumSquaredTime / nCalls;
-        double variance = meanOfSquares - meanSquared;
-        if (variance < 0)
-            return 0;  // might happen due to rounding error
-        return (long) Math.sqrt(variance);
-    }
-    
-    public String toString() {
-        return "\n" +
-        		"nCalls = " + nCalls + ";\n" +
-                "sumTime = " + getSumTime()/1000000000.0f + "s;\n" +
-                "minTime = " + minTime/1000000.0f + "ms;\n" +
-                "maxTime = " + maxTime/1000000.0f + "ms;\n" +
-                "meanTime = " + getMeanTime()/1000000.0f + "ms;\n" +
-                "stdDevTime = " + getStdDevTime()/1000000.0f + "ms;";
-    }
-    
-    public Call newCall() {
-        return new Call();
+  private int nCalls;
+  private long minTime;
+  private long maxTime;
+  private long sumTime;
+  private double sumSquaredTime;
+
+  /** Creates a new instance of CallStats */
+  public TimingStatistics() {
+  }
+
+  public TimingStatistics(int nCalls, long minTime, long maxTime, long sumTime,
+                          double sumSquaredTime) {
+    this.nCalls = nCalls;
+    this.minTime = minTime;
+    this.maxTime = maxTime;
+    this.sumTime = sumTime;
+    this.sumSquaredTime = sumSquaredTime;
+  }
+
+  public int getNCalls() {
+    return nCalls;
+  }
+
+  public long getMinTime() {
+    return Math.max(0, minTime);
+  }
+
+  public long getMaxTime() {
+    return maxTime;
+  }
+
+  public long getSumTime() {
+    return sumTime;
+  }
+
+  public double getSumSquaredTime() {
+    return sumSquaredTime;
+  }
+
+  public long getMeanTime() {
+    return nCalls == 0 ? 0 : sumTime / nCalls;
+  }
+
+  public long getStdDevTime() {
+    if (nCalls == 0)
+      return 0;
+    double mean = getMeanTime();
+    double meanSquared = mean * mean;
+    double meanOfSquares = sumSquaredTime / nCalls;
+    double variance = meanOfSquares - meanSquared;
+    if (variance < 0)
+      return 0;  // might happen due to rounding error
+    return (long) Math.sqrt(variance);
+  }
+
+  public String toString() {
+    return '\n' +
+        "nCalls = " + nCalls + ";\n" +
+        "sumTime = " + sumTime / 1000000000.0f + "s;\n" +
+        "minTime = " + minTime / 1000000.0f + "ms;\n" +
+        "maxTime = " + maxTime / 1000000.0f + "ms;\n" +
+        "meanTime = " + getMeanTime() / 1000000.0f + "ms;\n" +
+        "stdDevTime = " + getStdDevTime() / 1000000.0f + "ms;";
+  }
+
+  public Call newCall() {
+    return new Call();
+  }
+
+  public class Call {
+    private final long startTime = System.nanoTime();
+
+    private Call() {
     }
-    
-    public class Call {
-        private final long startTime = System.nanoTime();
-        private Call() {}
-        
-        public void end() {
-            long elapsed = System.nanoTime() - startTime;
-            synchronized (TimingStatistics.this) {
-                nCalls++;
-                if (elapsed < minTime || nCalls == 1)
-                    minTime = elapsed;
-                if (elapsed > maxTime)
-                    maxTime = elapsed;
-                sumTime += elapsed;
-                double elapsedFP = elapsed;
-                sumSquaredTime += elapsedFP * elapsedFP;
-            }
-        }
+
+    public void end() {
+      long elapsed = System.nanoTime() - startTime;
+      synchronized (TimingStatistics.this) {
+        nCalls++;
+        if (elapsed < minTime || nCalls == 1)
+          minTime = elapsed;
+        if (elapsed > maxTime)
+          maxTime = elapsed;
+        sumTime += elapsed;
+        double elapsedFP = elapsed;
+        sumSquaredTime += elapsedFP * elapsedFP;
+      }
     }
+  }
 }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/commandline/DefaultOptionCreator.java Sat Oct 17 09:42:31 2009
@@ -112,9 +112,7 @@
    * Returns a default command line option for help.
    * */
   public static Option helpOption(DefaultOptionBuilder obuilder) {
-    Option helpOpt = obuilder.withLongName("help").
-    withDescription("Print out help").withShortName("h").create();
-    return helpOpt;
+    return obuilder.withLongName("help").withDescription("Print out help").withShortName("h").create();
   }
 
 }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/SquaredEuclideanDistanceMeasure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/SquaredEuclideanDistanceMeasure.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/SquaredEuclideanDistanceMeasure.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/SquaredEuclideanDistanceMeasure.java Sat Oct 17 09:42:31 2009
@@ -24,7 +24,6 @@
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 
 /**
  * Like {@link EuclideanDistanceMeasure} but it does not take the square root. <p/> Thus, it is

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/TanimotoDistanceMeasure.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/TanimotoDistanceMeasure.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/TanimotoDistanceMeasure.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/distance/TanimotoDistanceMeasure.java Sat Oct 17 09:42:31 2009
@@ -19,10 +19,7 @@
 
 import org.apache.mahout.matrix.Vector;
 
-import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Set;
-
 
 /**
  * Tanimoto coefficient implementation.
@@ -48,7 +45,7 @@
     double denominator = dot(a, a) + dot(b, b) - ab;
     if(denominator < ab) {  // correct for fp round-off: distance >= 0
       denominator = ab;
-    };
+    }
     if(denominator > 0) {
         // denom == 0 only when dot(a,a) == dot(b,b) == dot(a,b) == 0
       return 1 - ab / denominator;
@@ -59,16 +56,15 @@
   
   public double dot(Vector a, Vector b) {
     Iterator<Vector.Element> it = a.iterateNonZero();
-    Vector.Element el = null;
+    Vector.Element el;
     Vector weights = getWeights();
     double dot = 0;
-    while(it.hasNext() && (el = it.next()) != null) {
-      try {
-      dot += el.get() * (a == b ? el.get() : b.getQuick(el.index())) * (weights == null ? 1.0 : weights.getQuick(el.index()));
-      } catch (NullPointerException npe) {
-        System.out.println(a.asFormatString() + "\n" + b.asFormatString() + "\n" + weights.asFormatString());
-        throw npe;
+    while (it.hasNext() && (el = it.next()) != null) {
+      double value = el.get() * (a == b ? el.get() : b.getQuick(el.index()));
+      if (weights != null) {
+        value *= weights.getQuick(el.index());
       }
+      dot += value;
     }
     return dot;
   }

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapred/partial/PartialBuilder.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapred/partial/PartialBuilder.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapred/partial/PartialBuilder.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapred/partial/PartialBuilder.java Sat Oct 17 09:42:31 2009
@@ -149,6 +149,7 @@
   protected static void processOutput(JobConf job, Path outputPath,
       int[] firstIds, TreeID[] keys, Node[] trees, PredictionCallback callback)
       throws IOException {
+    // TODO doesn't this assert throw NPE? looks like args are nullable
     assert keys.length == trees.length : "keys.length != trees.length";
     
     FileSystem fs = outputPath.getFileSystem(job);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/node/Leaf.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/node/Leaf.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/node/Leaf.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/node/Leaf.java Sat Oct 17 09:42:31 2009
@@ -22,13 +22,12 @@
 import java.io.IOException;
 import java.util.StringTokenizer;
 
-import org.apache.hadoop.io.Writable;
 import org.apache.mahout.df.data.Instance;
 
 /**
  * Represents a Leaf node
  */
-public class Leaf extends Node implements Writable {
+public class Leaf extends Node {
   private int label;
 
   protected Leaf() {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/tools/Describe.java Sat Oct 17 09:42:31 2009
@@ -86,7 +86,7 @@
 
       if (cmdLine.hasOption(helpOpt)) {
         CommandLineUtil.printHelp(group);
-        System.exit(-1);
+        return;
       }
 
       String dataPath = cmdLine.getValue(pathOpt).toString();
@@ -101,7 +101,6 @@
     } catch (OptionException e) {
       System.err.println("Exception : " + e);
       CommandLineUtil.printHelp(group);
-      System.exit(-1);
     }
   }
 

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseColumnMatrix.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseColumnMatrix.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseColumnMatrix.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseColumnMatrix.java Sat Oct 17 09:42:31 2009
@@ -182,8 +182,7 @@
   @Override
   public void readFields(DataInput in) throws IOException {
     super.readFields(in);
-    int[] card = {in.readInt(), in.readInt()};
-    this.cardinality = card;
+    this.cardinality = new int[]{in.readInt(), in.readInt()};
     int colSize = in.readInt();
     this.columns = new Vector[colSize];
     for (int col = 0; col < colSize; col++) {

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseRowMatrix.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseRowMatrix.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseRowMatrix.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/matrix/SparseRowMatrix.java Sat Oct 17 09:42:31 2009
@@ -178,8 +178,7 @@
   @Override
   public void readFields(DataInput in) throws IOException {
     super.readFields(in);
-    int[] card = {in.readInt(), in.readInt()};
-    this.cardinality = card;
+    this.cardinality = new int[]{in.readInt(), in.readInt()};
     int rowsize = in.readInt();
     this.rows = new Vector[rowsize];
     for (int row = 0; row < rowsize; row++) {

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/SpearmanCorrelationSimilarityTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/SpearmanCorrelationSimilarityTest.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/SpearmanCorrelationSimilarityTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/cf/taste/impl/similarity/SpearmanCorrelationSimilarityTest.java Sat Oct 17 09:42:31 2009
@@ -17,7 +17,6 @@
 
 package org.apache.mahout.cf.taste.impl.similarity;
 
-import org.apache.mahout.cf.taste.common.TasteException;
 import org.apache.mahout.cf.taste.model.DataModel;
 
 /** <p>Tests {@link SpearmanCorrelationSimilarity}.</p> */

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/VisibleCanopy.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/VisibleCanopy.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/VisibleCanopy.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/VisibleCanopy.java Sat Oct 17 09:42:31 2009
@@ -51,9 +51,7 @@
   public String toString() {
     String out = super.toString() + ": ";
     for (Vector pt : points) {
-      {
-        out = pt.asFormatString();
-      }
+      out = pt.asFormatString();
     }
     return out;
   }

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestLDAInference.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestLDAInference.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestLDAInference.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestLDAInference.java Sat Oct 17 09:42:31 2009
@@ -64,7 +64,6 @@
     double topicSmoothing = 50.0 / numTopics; // whatever
     Matrix m = new DenseMatrix(numTopics, numWords);
     double[] logTotals = new double[numTopics];
-    double ll = Double.NEGATIVE_INFINITY; // TODO this is not updated in loop?
 
     for (int k = 0; k < numTopics; ++k) {
       double total = 0.0; // total number of pseudo counts we made
@@ -78,6 +77,7 @@
       logTotals[k] = Math.log(total);
     }
 
+    double ll = Double.NEGATIVE_INFINITY;
     return new LDAState(numTopics, numWords, topicSmoothing, m, logTotals, ll);
   }
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestMapReduce.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestMapReduce.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestMapReduce.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/lda/TestMapReduce.java Sat Oct 17 09:42:31 2009
@@ -62,7 +62,6 @@
     double topicSmoothing = 50.0 / numTopics; // whatever
     Matrix m = new DenseMatrix(numTopics,numWords);
     double[] logTotals = new double[numTopics];
-    double ll = Double.NEGATIVE_INFINITY; // TODO this is not updated in loop?
     for(int k = 0; k < numTopics; ++k) {
       double total = 0.0; // total number of pseudo counts we made
       for(int w = 0; w < numWords; ++w) {
@@ -75,6 +74,7 @@
       logTotals[k] = Math.log(total);
     }
 
+    double ll = Double.NEGATIVE_INFINITY;
     return new LDAState(numTopics,numWords,topicSmoothing,m,logTotals,ll);
   }
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/distance/DefaultDistanceMeasureTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/distance/DefaultDistanceMeasureTest.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/distance/DefaultDistanceMeasureTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/distance/DefaultDistanceMeasureTest.java Sat Oct 17 09:42:31 2009
@@ -61,7 +61,7 @@
     compare(distanceMeasure, vectors);
   }
 
-  private void compare(DistanceMeasure distanceMeasure, Vector[] vectors) {
+  private static void compare(DistanceMeasure distanceMeasure, Vector[] vectors) {
      double[][] distanceMatrix = new double[4][4];
 
      for (int a = 0; a < 4; a++) {
@@ -87,7 +87,7 @@
         assertTrue("Distance between vectors less than zero: " 
                    + distanceMatrix[a][b] + " = " + distanceMeasure.toString() + 
                    ".distance("+ vectors[a].asFormatString() + ", " 
-                   + vectors[b].asFormatString() + ")", 
+                   + vectors[b].asFormatString() + ')',
                    distanceMatrix[a][b] >= 0);
         if(vectors[a].plus(vectors[b]).norm(2) == 0 && vectors[a].norm(2) > 0) {
           assertTrue("Distance from v to -v is equal to zero" 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/data/DataTest.java Sat Oct 17 09:42:31 2009
@@ -278,6 +278,7 @@
     sData = Utils.double2String(source);
     dataset = DataLoader.generateDataset(descriptor, sData);
     data = DataLoader.loadData(dataset, sData);
+    // TODO code1 is not used?
     code1 = dataset.labelCode(Double.toString(label1));
     int code2 = dataset.labelCode(Double.toString(label2));
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialBuilderTest.java Sat Oct 17 09:42:31 2009
@@ -71,11 +71,8 @@
     Writer writer = SequenceFile.createWriter(fs, job, outputFile,
         TreeID.class, MapredOutput.class);
 
-    try {
-      for (int index = 0; index < numTrees; index++) {
-        writer.append(keys[index], values[index]);
-      }
-    } finally {
+    for (int index = 0; index < numTrees; index++) {
+      writer.append(keys[index], values[index]);
     }
     writer.close();
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialSequentialBuilder.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialSequentialBuilder.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialSequentialBuilder.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapred/partial/PartialSequentialBuilder.java Sat Oct 17 09:42:31 2009
@@ -147,7 +147,7 @@
   @Override
   protected DecisionForest parseOutput(JobConf job, PredictionCallback callback)
       throws IOException {
-    int numMaps = job.getNumMapTasks();
+    //int numMaps = job.getNumMapTasks();
 
     DecisionForest forest = processOutput(firstOutput.keys, firstOutput.values, callback);
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapreduce/partial/Step0JobTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapreduce/partial/Step0JobTest.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapreduce/partial/Step0JobTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/df/mapreduce/partial/Step0JobTest.java Sat Oct 17 09:42:31 2009
@@ -152,7 +152,7 @@
 
     Job job = new Job();
     job.setInputFormatClass(TextInputFormat.class);
-    TextInputFormat.setInputPaths(job, dataPath);
+    FileInputFormat.setInputPaths(job, dataPath);
 
     setMaxSplitSize(job.getConfiguration(), dataPath, numMaps);
 

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java?rev=826208&r1=826207&r2=826208&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/matrix/VectorTest.java Sat Oct 17 09:42:31 2009
@@ -313,9 +313,7 @@
   private static Vector randomSparseVector(Random rnd) {
     SparseVector v1 = new SparseVector(50000);
     for (int i = 0; i < 1000; i++) {
-      {
-        v1.setQuick(rnd.nextInt(50000), rnd.nextDouble());
-      }
+      v1.setQuick(rnd.nextInt(50000), rnd.nextDouble());
     }
     return v1;
   }
@@ -368,9 +366,7 @@
     double[] values = {1.1, 2.2, 3.3};
     Vector test = new SparseVector(3);
     for (int i = 0; i < values.length; i++) {
-      {
-        test.set(i, values[i]);
-      }
+      test.set(i, values[i]);
     }
     Map<String, Integer> bindings = new HashMap<String, Integer>();
     bindings.put("Fee", 0);



Mime
View raw message