You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2010/02/10 01:03:18 UTC
svn commit: r908289 - in /lucene/mahout/trunk:
collections/src/main/java-templates/org/apache/mahout/math/list/
collections/src/main/java-templates/org/apache/mahout/math/map/
collections/src/test/java/org/apache/mahout/math/map/
collections/src/test/j...
Author: srowen
Date: Wed Feb 10 00:03:16 2010
New Revision: 908289
URL: http://svn.apache.org/viewvc?rev=908289&view=rev
Log:
More of my code style stuff
Removed:
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/example/
Modified:
lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeValueTypeMap.java.t
lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractObjectValueTypeMap.java.t
lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java
lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/set/OpenHashSetTest.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TestClassifier.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TrainClassifier.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/CanopyClusteringJob.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterDriver.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansDriver.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansJob.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/HadoopUtil.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/builder/DefaultTreeBuilder.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TransactionIterator.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerTupleIterator.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FrequentPatternMaxHeap.java
lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/VectorWritable.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java
lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/DummyReporter.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaXmlSplitter.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/dirichlet/DisplayDirichlet.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/Job.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputDriver.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputMapper.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputDriver.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/BreimanExample.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapred/BuildForest.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/DeliciousTagsExample.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleGrouper.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java
lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java
Modified: lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t (original)
+++ lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t Wed Feb 10 00:03:16 2010
@@ -34,8 +34,8 @@
//CHECKSTYLE:ON
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
+
/**
Abstract base class for resizable lists holding <code>${valueType}</code> elements; abstract.
*/
Modified: lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeValueTypeMap.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeValueTypeMap.java.t?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeValueTypeMap.java.t (original)
+++ lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractKeyTypeValueTypeMap.java.t Wed Feb 10 00:03:16 2010
@@ -181,7 +181,7 @@
/**
* Returns the value associated with the specified key. It is often a good idea to first check with {@link
- * #containsKey(int)} whether the given key has a value associated or not, i.e. whether there exists an association
+ * #containsKey(${keyType})} whether the given key has a value associated or not, i.e. whether there exists an association
* for the given key or not.
*
* @param key the key to be searched for.
Modified: lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractObjectValueTypeMap.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractObjectValueTypeMap.java.t?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractObjectValueTypeMap.java.t (original)
+++ lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/map/AbstractObjectValueTypeMap.java.t Wed Feb 10 00:03:16 2010
@@ -164,7 +164,7 @@
/**
* Applies a procedure to each (key,value) pair of the receiver, if any. Iteration order is guaranteed to be
- * <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}.
+ * <i>identical</i> to the order used by method {@link #forEachKey(ObjectProcedure)}.
*
* @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise
* continues.
@@ -194,7 +194,7 @@
/**
* Returns a list filled with all keys contained in the receiver. The returned list has a size that equals
* <tt>this.size()</tt>. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link
- * #forEachKey(IntProcedure)}. <p> This method can be used to iterate over the keys of the receiver.
+ * #forEachKey(ObjectProcedure)}. <p> This method can be used to iterate over the keys of the receiver.
*
* @return the keys.
*/
@@ -207,7 +207,7 @@
/**
* Fills all keys contained in the receiver into the specified list. Fills the list, starting at index 0. After this
* call returns the specified list has a new size that equals <tt>this.size()</tt>. Iteration order is guaranteed to
- * be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}. <p> This method can be used to
+ * be <i>identical</i> to the order used by method {@link #forEachKey(ObjectProcedure)}. <p> This method can be used to
* iterate over the keys of the receiver.
*
* @param list the list to be filled, can have any size.
@@ -241,7 +241,8 @@
/**
* Fills all pairs satisfying a given condition into the specified lists. Fills into the lists, starting at index 0.
* After this call returns the specified lists both have a new size, the number of pairs satisfying the condition.
- * Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}.
+ * Iteration order is guaranteed to be <i>identical</i> to the order used by method
+ * {@link #forEachKey(ObjectProcedure)}.
* <p> <b>Example:</b> <br>
* <pre>
* IntIntProcedure condition = new IntIntProcedure() { // match even keys only
@@ -407,7 +408,7 @@
/**
* Returns a list filled with all values contained in the receiver. The returned list has a size that equals
* <tt>this.size()</tt>. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link
- * #forEachKey(IntProcedure)}. <p> This method can be used to iterate over the values of the receiver.
+ * #forEachKey(ObjectProcedure)}. <p> This method can be used to iterate over the values of the receiver.
*
* @return the values.
*/
@@ -420,7 +421,7 @@
/**
* Fills all values contained in the receiver into the specified list. Fills the list, starting at index 0. After this
* call returns the specified list has a new size that equals <tt>this.size()</tt>. Iteration order is guaranteed to
- * be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}. <p> This method can be used to
+ * be <i>identical</i> to the order used by method {@link #forEachKey(ObjectProcedure)}. <p> This method can be used to
* iterate over the values of the receiver.
*
* @param list the list to be filled, can have any size.
Modified: lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java (original)
+++ lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/map/OpenHashMapTest.java Wed Feb 10 00:03:16 2010
@@ -254,8 +254,8 @@
map.put("Fourteen", "14");
map.remove(new String("Thirteen"));
OpenHashMap<String, String> map2 = (OpenHashMap<String, String>) map.clone();
- assertTrue(map.equals(map2));
- assertTrue(map2.equals(map));
+ assertEquals(map, map2);
+ assertEquals(map2, map);
assertFalse("Hello Sailor".equals(map));
assertFalse(map.equals("hello sailor"));
map2.remove("Eleven");
Modified: lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/set/OpenHashSetTest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/set/OpenHashSetTest.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/set/OpenHashSetTest.java (original)
+++ lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/set/OpenHashSetTest.java Wed Feb 10 00:03:16 2010
@@ -27,7 +27,6 @@
import org.apache.mahout.math.function.ObjectProcedure;
import org.apache.mahout.math.map.PrimeFinder;
-import org.apache.mahout.math.set.AbstractSet;
import org.junit.Assert;
import org.junit.Test;
@@ -153,8 +152,8 @@
map.add("14");
map.remove("13");
OpenHashSet<String> map2 = (OpenHashSet<String>) map.clone();
- assertTrue(map.equals(map2));
- assertTrue(map2.equals(map));
+ assertEquals(map, map2);
+ assertEquals(map2, map);
assertFalse("Hello Sailor".equals(map));
assertFalse(map.equals("hello sailor"));
map2.remove("11");
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TestClassifier.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TestClassifier.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TestClassifier.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TestClassifier.java Wed Feb 10 00:03:16 2010
@@ -197,11 +197,12 @@
params.set("alpha_i", alphaI);
params.set("testDirPath", testDirPath);
- if (classificationMethod.equalsIgnoreCase("sequential")) classifySequential(params);
- else if (classificationMethod.equalsIgnoreCase("mapreduce")) classifyParallel(params);
+ if (classificationMethod.equalsIgnoreCase("sequential"))
+ classifySequential(params);
+ else if (classificationMethod.equalsIgnoreCase("mapreduce"))
+ classifyParallel(params);
} catch (OptionException e) {
CommandLineUtil.printHelp(group);
- return;
}
}
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TrainClassifier.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TrainClassifier.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TrainClassifier.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/classifier/bayes/TrainClassifier.java Wed Feb 10 00:03:16 2010
@@ -50,27 +50,19 @@
public static void trainNaiveBayes(String dir,
String outputDir,
- BayesParameters params) throws IOException,
- InterruptedException,
- ClassNotFoundException {
+ BayesParameters params) throws IOException {
BayesDriver driver = new BayesDriver();
driver.runJob(dir, outputDir, params);
}
public static void trainCNaiveBayes(String dir,
String outputDir,
- BayesParameters params) throws IOException,
- InterruptedException,
- ClassNotFoundException {
+ BayesParameters params) throws IOException {
CBayesDriver driver = new CBayesDriver();
driver.runJob(dir, outputDir, params);
}
- public static void main(String[] args) throws IOException,
- NumberFormatException,
- IllegalStateException,
- InterruptedException,
- ClassNotFoundException {
+ public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
@@ -158,9 +150,8 @@
(String) cmdLine.getValue(outputOpt), params);
}
} catch (OptionException e) {
- log.info("{}", e);
+ log.error("Error while parsing options", e);
CommandLineUtil.printHelp(group);
- return;
}
}
}
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=908289&r1=908288&r2=908289&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 Wed Feb 10 00:03:16 2010
@@ -51,9 +51,7 @@
* @throws Exception
* any exception thrown at job execution.
* */
- public static void execute(String[] args, BayesJob job) throws ClassNotFoundException,
- IOException,
- InterruptedException {
+ public static void execute(String[] args, BayesJob job) throws IOException {
GroupBuilder gbuilder = new GroupBuilder();
Option inputOpt = DefaultOptionCreator.inputOption().create();
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusteringJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusteringJob.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusteringJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusteringJob.java Wed Feb 10 00:03:16 2010
@@ -25,8 +25,6 @@
import org.apache.commons.cli2.builder.DefaultOptionBuilder;
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
-import org.apache.mahout.math.RandomAccessSparseVector;
-import org.apache.mahout.math.Vector;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
import org.slf4j.Logger;
@@ -107,9 +105,9 @@
measureClass = cmdLine.getValue(measureClassOpt).toString();
}
- Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
- RandomAccessSparseVector.class
- : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
+ //Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
+ // RandomAccessSparseVector.class
+ // : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
double t1 = Double.parseDouble(cmdLine.getValue(t1Opt).toString());
double t2 = Double.parseDouble(cmdLine.getValue(t2Opt).toString());
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyDriver.java Wed Feb 10 00:03:16 2010
@@ -35,8 +35,6 @@
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.SequenceFileInputFormat;
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
-import org.apache.mahout.math.RandomAccessSparseVector;
-import org.apache.mahout.math.Vector;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
import org.apache.mahout.math.VectorWritable;
@@ -105,9 +103,9 @@
measureClass = cmdLine.getValue(measureClassOpt).toString();
}
- Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
- RandomAccessSparseVector.class
- : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
+ //Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
+ // RandomAccessSparseVector.class
+ // : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
double t1 = Double.parseDouble(cmdLine.getValue(t1Opt).toString());
double t2 = Double.parseDouble(cmdLine.getValue(t2Opt).toString());
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterDriver.java Wed Feb 10 00:03:16 2010
@@ -36,8 +36,6 @@
import org.apache.hadoop.mapred.SequenceFileInputFormat;
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
import org.apache.hadoop.mapred.lib.IdentityReducer;
-import org.apache.mahout.math.RandomAccessSparseVector;
-import org.apache.mahout.math.Vector;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
import org.apache.mahout.math.VectorWritable;
@@ -112,9 +110,9 @@
String output = cmdLine.getValue(outputOpt).toString();
String canopies = cmdLine.getValue(canopiesOpt).toString();
String points = cmdLine.getValue(pointsOpt).toString();
- Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
- RandomAccessSparseVector.class
- : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
+ //Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
+ // RandomAccessSparseVector.class
+ // : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
double t1 = Double.parseDouble(cmdLine.getValue(t1Opt).toString());
double t2 = Double.parseDouble(cmdLine.getValue(t2Opt).toString());
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletDriver.java Wed Feb 10 00:03:16 2010
@@ -68,8 +68,7 @@
private DirichletDriver() {
}
- public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException,
- IOException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+ public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
@@ -145,9 +144,15 @@
* @deprecated since it presumes 2-d, dense vector model prototypes
*/
@Deprecated
- public static void runJob(String input, String output, String modelFactory, int numClusters, int maxIterations, double alpha_0,
- int numReducers) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException,
- SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+ public static void runJob(String input,
+ String output,
+ String modelFactory,
+ int numClusters,
+ int maxIterations,
+ double alpha_0,
+ int numReducers)
+ throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException,
+ SecurityException, NoSuchMethodException, InvocationTargetException {
runJob(input, output, modelFactory, "org.apache.mahout.math.DenseVector", 2, numClusters, maxIterations, alpha_0, numReducers);
}
@@ -168,7 +173,7 @@
*/
public static void runJob(String input, String output, String modelFactory, String modelPrototype, int prototypeSize,
int numClusters, int maxIterations, double alpha_0, int numReducers) throws ClassNotFoundException, InstantiationException,
- IllegalAccessException, IOException, SecurityException, IllegalArgumentException, NoSuchMethodException,
+ IllegalAccessException, IOException, SecurityException, NoSuchMethodException,
InvocationTargetException {
String stateIn = output + "/state-0";
@@ -186,7 +191,7 @@
private static void writeInitialState(String output, String stateIn, String modelFactory, String modelPrototype,
int prototypeSize, int numModels, double alpha_0) throws ClassNotFoundException, InstantiationException,
- IllegalAccessException, IOException, SecurityException, IllegalArgumentException, NoSuchMethodException,
+ IllegalAccessException, IOException, SecurityException, NoSuchMethodException,
InvocationTargetException {
DirichletState<VectorWritable> state = createState(modelFactory, modelPrototype, prototypeSize, numModels, alpha_0);
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/dirichlet/DirichletJob.java Wed Feb 10 00:03:16 2010
@@ -44,8 +44,7 @@
private DirichletJob() {
}
- public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException,
- IllegalAccessException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+ public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
@@ -119,7 +118,7 @@
*/
public static void runJob(String input, String output, String modelFactory, String modelPrototype, int prototypeSize,
int numModels, int maxIterations, double alpha_0) throws IOException, ClassNotFoundException, InstantiationException,
- IllegalAccessException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+ IllegalAccessException, SecurityException, NoSuchMethodException, InvocationTargetException {
// delete the output directory
Configuration conf = new JobConf(DirichletJob.class);
Path outPath = new Path(output);
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansDriver.java Wed Feb 10 00:03:16 2010
@@ -40,8 +40,6 @@
import org.apache.hadoop.mapred.SequenceFileInputFormat;
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
import org.apache.mahout.clustering.kmeans.RandomSeedGenerator;
-import org.apache.mahout.math.RandomAccessSparseVector;
-import org.apache.mahout.math.Vector;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.HadoopUtil;
import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
@@ -150,9 +148,9 @@
}
float m = Float.parseFloat(cmdLine.getValue(mOpt).toString());
- Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
- RandomAccessSparseVector.class
- : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
+ //Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ?
+ // RandomAccessSparseVector.class
+ // : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
int numReduceTasks = 10;
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansJob.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansJob.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansJob.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/fuzzykmeans/FuzzyKMeansJob.java Wed Feb 10 00:03:16 2010
@@ -26,7 +26,6 @@
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
import org.apache.mahout.clustering.canopy.CanopyDriver;
-import org.apache.mahout.math.Vector;
import org.apache.mahout.common.commandline.DefaultOptionCreator;
import org.apache.mahout.common.distance.ManhattanDistanceMeasure;
import org.apache.mahout.common.CommandLineUtil;
@@ -104,7 +103,7 @@
boolean doCanopy = Boolean.parseBoolean(cmdLine.getValue(doCanopyOpt).toString());
float m = Float.parseFloat(cmdLine.getValue(mOpt).toString());
String vectorClassName = cmdLine.getValue(vectorClassOpt).toString();
- Class<? extends Vector> vectorClass = (Class<? extends Vector>) Class.forName(vectorClassName);
+ //Class<? extends Vector> vectorClass = (Class<? extends Vector>) Class.forName(vectorClassName);
runJob(input, clusters, output, measureClass, convergenceDelta,
maxIterations, numMapTasks, numReduceTasks, doCanopy, m);
} catch (OptionException e) {
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/kmeans/KMeansDriver.java Wed Feb 10 00:03:16 2010
@@ -36,8 +36,6 @@
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.SequenceFileInputFormat;
import org.apache.hadoop.mapred.SequenceFileOutputFormat;
-import org.apache.mahout.math.RandomAccessSparseVector;
-import org.apache.mahout.math.Vector;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.HadoopUtil;
import org.apache.mahout.common.distance.SquaredEuclideanDistanceMeasure;
@@ -141,8 +139,8 @@
convergenceDelta = Double.parseDouble(cmdLine.getValue(convergenceDeltaOpt).toString());
}
- Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ? RandomAccessSparseVector.class
- : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
+ //Class<? extends Vector> vectorClass = cmdLine.hasOption(vectorClassOpt) == false ? RandomAccessSparseVector.class
+ // : (Class<? extends Vector>) Class.forName(cmdLine.getValue(vectorClassOpt).toString());
int maxIterations = 20;
if (cmdLine.hasOption(maxIterationsOpt)) {
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/HadoopUtil.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/HadoopUtil.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/HadoopUtil.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/common/HadoopUtil.java Wed Feb 10 00:03:16 2010
@@ -18,7 +18,6 @@
package org.apache.mahout.common;
import java.io.IOException;
-import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -54,9 +53,8 @@
}
}
- public static void deletePaths(List<Path> paths, FileSystem fs) throws IOException {
- for (int i = 0; i < paths.size(); i++) {
- Path path = paths.get(i);
+ public static void deletePaths(Iterable<Path> paths, FileSystem fs) throws IOException {
+ for (Path path : paths) {
if (fs.exists(path)) {
log.warn("Deleting {}", path);
fs.delete(path, true);
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/builder/DefaultTreeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/builder/DefaultTreeBuilder.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/builder/DefaultTreeBuilder.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/builder/DefaultTreeBuilder.java Wed Feb 10 00:03:16 2010
@@ -95,7 +95,7 @@
log.warn("attribute {} already selected in a parent node", best.attr);
}
- Node childNode = null;
+ Node childNode;
if (data.getDataset().isNumerical(best.attr)) {
Data loSubset = data.subset(Condition.lesser(best.attr, best.split));
Node loChild = build(rng, loSubset);
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/df/mapreduce/partial/Step0Job.java Wed Feb 10 00:03:16 2010
@@ -238,7 +238,7 @@
*
*/
public static class Step0Output implements Writable,
- Comparable<Step0Output> {
+ Comparable<Step0Output>, Cloneable {
/**
* first key of the partition<br>
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/TransactionTree.java Wed Feb 10 00:03:16 2010
@@ -40,9 +40,9 @@
/**
* A compact representation of transactions modeled on the lines to
- * {@link FPTree} This reduces plenty of space and speeds up Map/Reduce of
+ * {@link org.apache.mahout.fpm.pfpgrowth.fpgrowth.FPTree} This reduces plenty of space and speeds up Map/Reduce of
* {@link PFPGrowth} algorithm by reducing data size passed from the Mapper to
- * the reducer where {@link FPGrowth} mining is done
+ * the reducer where {@link org.apache.mahout.fpm.pfpgrowth.fpgrowth.FPGrowth} mining is done
*/
public final class TransactionTree implements Writable {
/**
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TopKPatternsOutputConverter.java Wed Feb 10 00:03:16 2010
@@ -40,7 +40,7 @@
private OutputCollector<A,List<Pair<List<A>,Long>>> collector = null;
- private Map<Integer,A> reverseMapping;
+ private final Map<Integer,A> reverseMapping;
public TopKPatternsOutputConverter(OutputCollector<A,List<Pair<List<A>,Long>>> collector,
Map<Integer,A> reverseMapping) {
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TransactionIterator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TransactionIterator.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TransactionIterator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/TransactionIterator.java Wed Feb 10 00:03:16 2010
@@ -30,11 +30,11 @@
* @param <AP>
*/
public class TransactionIterator<AP> implements Iterator<Pair<int[],Long>> {
- private Map<AP,Integer> attributeIdMapping;
+ private final Map<AP,Integer> attributeIdMapping;
- private Iterator<Pair<List<AP>,Long>> iterator;
+ private final Iterator<Pair<List<AP>,Long>> iterator;
- private int[] transactionBuffer;
+ private final int[] transactionBuffer;
public TransactionIterator(Iterator<Pair<List<AP>,Long>> iterator,
Map<AP,Integer> attributeIdMapping) {
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerStringOutputConverter.java Wed Feb 10 00:03:16 2010
@@ -32,9 +32,9 @@
public final class IntegerStringOutputConverter implements
OutputCollector<Integer,List<Pair<List<Integer>,Long>>> {
- private OutputCollector<Text,TopKStringPatterns> collector;
+ private final OutputCollector<Text,TopKStringPatterns> collector;
- private List<String> featureReverseMap;
+ private final List<String> featureReverseMap;
public IntegerStringOutputConverter(OutputCollector<Text,TopKStringPatterns> collector,
List<String> featureReverseMap) {
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerTupleIterator.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerTupleIterator.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerTupleIterator.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/integer/IntegerTupleIterator.java Wed Feb 10 00:03:16 2010
@@ -21,13 +21,13 @@
import java.util.List;
import org.apache.mahout.common.IntegerTuple;
+
/**
* Iterates over an integer tuple and output it as a list
- *
*/
public final class IntegerTupleIterator implements Iterator<List<Integer>> {
- private Iterator<IntegerTuple> iterator;
+ private final Iterator<IntegerTuple> iterator;
public IntegerTupleIterator(Iterator<IntegerTuple> iterator) {
this.iterator = iterator;
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/convertors/string/TopKStringPatterns.java Wed Feb 10 00:03:16 2010
@@ -33,7 +33,7 @@
*
*/
public final class TopKStringPatterns implements Writable {
- private List<Pair<List<String>,Long>> frequentPatterns;
+ private final List<Pair<List<String>,Long>> frequentPatterns;
public TopKStringPatterns() {
frequentPatterns = new ArrayList<Pair<List<String>,Long>>();
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FPGrowth.java Wed Feb 10 00:03:16 2010
@@ -49,8 +49,7 @@
/**
* Implementation of PFGrowth Algorithm with FP-Bonsai pruning
*
- * @param A
- * The object type used as the cell items in a transaction list
+ * Generic parameter A is the object type used as the cell items in a transaction list.
*/
public class FPGrowth<A extends Comparable<? super A>> {
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FrequentPatternMaxHeap.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FrequentPatternMaxHeap.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FrequentPatternMaxHeap.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/fpm/pfpgrowth/fpgrowth/FrequentPatternMaxHeap.java Wed Feb 10 00:03:16 2010
@@ -30,13 +30,13 @@
private Pattern least;
- private int maxSize;
+ private final int maxSize;
- private boolean subPatternCheck;
+ private final boolean subPatternCheck;
- private OpenLongObjectHashMap<Set<Pattern>> patternIndex;
+ private final OpenLongObjectHashMap<Set<Pattern>> patternIndex;
- private PriorityQueue<Pattern> queue;
+ private final PriorityQueue<Pattern> queue;
public FrequentPatternMaxHeap(int numResults, boolean subPatternCheck) {
maxSize = numResults;
Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/VectorWritable.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/VectorWritable.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/VectorWritable.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/math/VectorWritable.java Wed Feb 10 00:03:16 2010
@@ -50,8 +50,8 @@
@Override
public void write(DataOutput out) throws IOException {
- Writable w = null;
- if(vector instanceof Writable) {
+ Writable w;
+ if (vector instanceof Writable) {
w = (Writable) vector;
} else if(vector instanceof RandomAccessSparseVector) {
w = new RandomAccessSparseVectorWritable(vector);
@@ -67,7 +67,7 @@
public void readFields(DataInput in) throws IOException {
try {
String vectorClassName = in.readUTF();
- Class<? extends Vector> inputClass = (Class<? extends Vector>) getConf().getClassByName(vectorClassName);
+ Class<? extends Vector> inputClass = getConf().getClassByName(vectorClassName).asSubclass(Vector.class);
Class<? extends Vector> vectorClass = getConf().getClass("vector.class", inputClass, Vector.class);
vector = ReflectionUtils.newInstance(vectorClass, getConf());
((Writable)vector).readFields(in);
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/dirichlet/TestMapReduce.java Wed Feb 10 00:03:16 2010
@@ -20,7 +20,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
@@ -115,7 +114,7 @@
for (VectorWritable v : sampleData) {
mapper.map(null, v, collector, null);
}
- Map<String, List<VectorWritable>> data = collector.getData();
+ //Map<String, List<VectorWritable>> data = collector.getData();
// this seed happens to produce two partitions, but they work
//assertEquals("output size", 3, data.size());
}
@@ -135,7 +134,7 @@
for (VectorWritable v : sampleData) {
mapper.map(null, v, mapCollector, null);
}
- Map<String, List<VectorWritable>> data = mapCollector.getData();
+ //Map<String, List<VectorWritable>> data = mapCollector.getData();
// this seed happens to produce three partitions, but they work
//assertEquals("output size", 7, data.size());
Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/DummyReporter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/DummyReporter.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/DummyReporter.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/common/DummyReporter.java Wed Feb 10 00:03:16 2010
@@ -27,10 +27,10 @@
import org.apache.hadoop.mapred.Counters.Counter;
public class DummyReporter implements Reporter {
-
- private String status = "";
- private Map<Enum<?>,MutableLong> count1 = new HashMap<Enum<?>,MutableLong>();
- private Map<String,Map<String,MutableLong>> count2 = new HashMap<String,Map<String,MutableLong>>();
+
+ //private String status = "";
+ private final Map<Enum<?>,MutableLong> count1 = new HashMap<Enum<?>,MutableLong>();
+ private final Map<String,Map<String,MutableLong>> count2 = new HashMap<String,Map<String,MutableLong>>();
@Override
public Counter getCounter(Enum<?> name) {
@@ -69,7 +69,7 @@
@Override
public void setStatus(String status) {
- this.status = status;
+ //this.status = status;
}
@Override
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/PrepareTwentyNewsgroups.java Wed Feb 10 00:03:16 2010
@@ -45,11 +45,7 @@
private PrepareTwentyNewsgroups() { }
- public static void main(String[] args) throws IOException,
- ClassNotFoundException,
- InstantiationException,
- IllegalAccessException,
- OptionException {
+ public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaXmlSplitter.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaXmlSplitter.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaXmlSplitter.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/classifier/bayes/WikipediaXmlSplitter.java Wed Feb 10 00:03:16 2010
@@ -41,6 +41,8 @@
import org.apache.hadoop.io.compress.CompressionCodec;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.FileLineIterator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Splits the wikipedia xml file in to chunks of size as specified by command
@@ -48,9 +50,12 @@
*
*/
public final class WikipediaXmlSplitter {
+
+ private static final Logger log = LoggerFactory.getLogger(WikipediaXmlSplitter.class);
+
private WikipediaXmlSplitter() { }
- public static void main(String[] args) throws IOException, OptionException {
+ public static void main(String[] args) throws IOException {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
@@ -114,7 +119,7 @@
try {
cmdLine = parser.parse(args);
} catch (OptionException e) {
- System.err.println(e.getMessage());
+ log.error("Error while parsing options", e);
CommandLineUtil.printHelp(group);
return;
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/dirichlet/DisplayDirichlet.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/dirichlet/DisplayDirichlet.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/dirichlet/DisplayDirichlet.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/dirichlet/DisplayDirichlet.java Wed Feb 10 00:03:16 2010
@@ -27,10 +27,8 @@
import java.awt.geom.AffineTransform;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import java.io.IOException;
import org.apache.mahout.clustering.dirichlet.models.Model;
import org.apache.mahout.clustering.dirichlet.models.ModelDistribution;
@@ -98,7 +96,7 @@
});
}
- public static void main(String[] args) throws IOException, InvocationTargetException, NoSuchMethodException {
+ public static void main(String[] args) {
RandomUtils.useTestSeed();
generateSamples();
new DisplayDirichlet();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/InputDriver.java Wed Feb 10 00:03:16 2010
@@ -48,7 +48,7 @@
private InputDriver() {
}
- public static void main(String[] args) throws IOException, ClassNotFoundException {
+ public static void main(String[] args) throws IOException {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/Job.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/Job.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/Job.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/canopy/Job.java Wed Feb 10 00:03:16 2010
@@ -97,7 +97,7 @@
measureClassOpt, "org.apache.mahout.common.distance.EuclideanDistanceMeasure").toString();
String className = cmdLine.getValue(vectorClassOpt, "org.apache.mahout.math.RandomAccessSparseVector").toString();
- Class<? extends Vector> vectorClass = Class.forName(className).asSubclass(Vector.class);
+ //Class<? extends Vector> vectorClass = Class.forName(className).asSubclass(Vector.class);
double t1 = Double.parseDouble(cmdLine.getValue(t1Opt, "80").toString());
double t2 = Double.parseDouble(cmdLine.getValue(t2Opt, "55").toString());
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/dirichlet/Job.java Wed Feb 10 00:03:16 2010
@@ -17,8 +17,6 @@
package org.apache.mahout.clustering.syntheticcontrol.dirichlet;
-import static org.apache.mahout.clustering.syntheticcontrol.Constants.DIRECTORY_CONTAINING_CONVERTED_INPUT;
-
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@@ -41,6 +39,7 @@
import org.apache.mahout.clustering.dirichlet.DirichletMapper;
import org.apache.mahout.clustering.dirichlet.models.Model;
import org.apache.mahout.clustering.kmeans.KMeansDriver;
+import org.apache.mahout.clustering.syntheticcontrol.Constants;
import org.apache.mahout.clustering.syntheticcontrol.canopy.InputDriver;
import org.apache.mahout.common.CommandLineUtil;
import org.apache.mahout.common.commandline.DefaultOptionCreator;
@@ -51,13 +50,12 @@
public class Job {
/**Logger for this class.*/
- private static final Logger LOG = LoggerFactory.getLogger(Job.class);
+ private static final Logger log = LoggerFactory.getLogger(Job.class);
private Job() {
}
- public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException,
- IllegalAccessException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+ public static void main(String[] args) throws Exception {
DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
@@ -107,7 +105,7 @@
String vectorClassName = cmdLine.getValue(vectorOpt, "org.apache.mahout.math.RandomAccessSparseVector").toString();
runJob(input, output, modelFactory, numModels, maxIterations, alpha_0, numReducers, vectorClassName);
} catch (OptionException e) {
- LOG.error("Exception parsing command line: ", e);
+ log.error("Exception parsing command line: ", e);
CommandLineUtil.printHelp(group);
}
}
@@ -131,9 +129,16 @@
* @throws IllegalArgumentException
* @throws SecurityException
*/
- public static void runJob(String input, String output, String modelFactory, int numModels, int maxIterations, double alpha_0,
- int numReducers, String vectorClassName) throws IOException, ClassNotFoundException, InstantiationException,
- IllegalAccessException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
+ public static void runJob(String input,
+ String output,
+ String modelFactory,
+ int numModels,
+ int maxIterations,
+ double alpha_0,
+ int numReducers,
+ String vectorClassName)
+ throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException,
+ SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
// delete the output directory
JobConf conf = new JobConf(DirichletJob.class);
Path outPath = new Path(output);
@@ -142,10 +147,17 @@
fs.delete(outPath, true);
}
fs.mkdirs(outPath);
- final String directoryContainingConvertedInput = output + DIRECTORY_CONTAINING_CONVERTED_INPUT;
+ String directoryContainingConvertedInput = output + Constants.DIRECTORY_CONTAINING_CONVERTED_INPUT;
InputDriver.runJob(input, directoryContainingConvertedInput, vectorClassName);
- DirichletDriver.runJob(directoryContainingConvertedInput, output + "/state", modelFactory, vectorClassName, 60, numModels,
- maxIterations, alpha_0, numReducers);
+ DirichletDriver.runJob(directoryContainingConvertedInput,
+ output + "/state",
+ modelFactory,
+ vectorClassName,
+ 60,
+ numModels,
+ maxIterations,
+ alpha_0,
+ numReducers);
printResults(output + "/state", modelFactory, vectorClassName, 60, maxIterations, numModels, alpha_0);
}
@@ -186,17 +198,19 @@
*/
private static void printResults(List<List<DirichletCluster<VectorWritable>>> clusters, int significant) {
int row = 0;
+ StringBuilder result = new StringBuilder();
for (List<DirichletCluster<VectorWritable>> r : clusters) {
- System.out.print("sample[" + row++ + "]= ");
+ result.append("sample=").append(row++).append("]= ");
for (int k = 0; k < r.size(); k++) {
Model<VectorWritable> model = r.get(k).getModel();
if (model.count() > significant) {
int total = (int) r.get(k).getTotalCount();
- System.out.print("m" + k + '(' + total + ')' + model.toString() + ", ");
+ result.append('m').append(k).append('(').append(total).append(')').append(model).append(", ");
}
}
- System.out.println();
+ result.append('\n');
}
- System.out.println();
+ result.append('\n');
+ log.info(result.toString());
}
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputDriver.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputDriver.java Wed Feb 10 00:03:16 2010
@@ -23,8 +23,6 @@
import org.apache.commons.cli2.Group;
import org.apache.commons.cli2.Option;
import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
import org.apache.hadoop.fs.Path;
@@ -49,8 +47,6 @@
}
public static void main(String[] args) throws IOException {
- DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
- ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option inputOpt = DefaultOptionCreator.inputOption().withRequired(false).create();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputMapper.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputMapper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/InputMapper.java Wed Feb 10 00:03:16 2010
@@ -36,7 +36,7 @@
Mapper<LongWritable, Text, Text, MeanShiftCanopy> {
private static final Pattern SPACE = Pattern.compile(" ");
- int nextCanopyId = 0;
+ private int nextCanopyId = 0;
@Override
public void map(LongWritable key, Text values,
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/Job.java Wed Feb 10 00:03:16 2010
@@ -131,7 +131,7 @@
if (dfs.exists(outPath)) {
dfs.delete(outPath, true);
}
- final String directoryContainingConvertedInput = output + Constants.DIRECTORY_CONTAINING_CONVERTED_INPUT;
+ String directoryContainingConvertedInput = output + Constants.DIRECTORY_CONTAINING_CONVERTED_INPUT;
InputDriver.runJob(input, directoryContainingConvertedInput);
MeanShiftCanopyJob.runJob(directoryContainingConvertedInput, output + "/meanshift",
measureClassName, t1, t2, convergenceDelta, maxIterations);
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputDriver.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputDriver.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputDriver.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/clustering/syntheticcontrol/meanshift/OutputDriver.java Wed Feb 10 00:03:16 2010
@@ -23,8 +23,6 @@
import org.apache.commons.cli2.Group;
import org.apache.commons.cli2.Option;
import org.apache.commons.cli2.OptionException;
-import org.apache.commons.cli2.builder.ArgumentBuilder;
-import org.apache.commons.cli2.builder.DefaultOptionBuilder;
import org.apache.commons.cli2.builder.GroupBuilder;
import org.apache.commons.cli2.commandline.Parser;
import org.apache.hadoop.fs.Path;
@@ -48,8 +46,6 @@
}
public static void main(String[] args) throws IOException {
- DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
- ArgumentBuilder abuilder = new ArgumentBuilder();
GroupBuilder gbuilder = new GroupBuilder();
Option inputOpt = DefaultOptionCreator.inputOption().withRequired(false).create();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/BreimanExample.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/BreimanExample.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/BreimanExample.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/BreimanExample.java Wed Feb 10 00:03:16 2010
@@ -57,25 +57,25 @@
private static final Logger log = LoggerFactory.getLogger(BreimanExample.class);
/** sum test error */
- private static double sumTestErr;
+ private double sumTestErr;
/** sum mean tree error */
- private static double sumTreeErr;
+ private double sumTreeErr;
/** sum test error with m=1 */
- private static double sumOneErr = 0.0;
+ private double sumOneErr;
/** mean time to build a forest with m=log2(M)+1 */
- private static long sumTimeM;
+ private long sumTimeM;
/** mean time to build a forest with m=1 */
- private static long sumTimeOne;
+ private long sumTimeOne;
/** mean number of nodes for all the trees grown with m=log2(M)+1 */
- protected static long numNodesM;
+ private long numNodesM;
/** mean number of nodes for all the trees grown with m=1 */
- protected static long numNodesOne;
+ private long numNodesOne;
/**
* runs one iteration of the procedure.
@@ -86,7 +86,7 @@
* @param nbtrees number of trees to grow
* @throws Exception if an error occured while growing the trees
*/
- protected static void runIteration(Random rng, Data data, int m, int nbtrees) {
+ private void runIteration(Random rng, Data data, int m, int nbtrees) {
int nblabels = data.getDataset().nblabels();
@@ -202,7 +202,7 @@
dataPath = new Path(dataName);
datasetPath = new Path(datasetName);
} catch (OptionException e) {
- System.err.println("Exception : " + e);
+ log.error("Error while parsing options", e);
CommandLineUtil.printHelp(group);
return -1;
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapred/BuildForest.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapred/BuildForest.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapred/BuildForest.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/df/mapred/BuildForest.java Wed Feb 10 00:03:16 2010
@@ -149,7 +149,7 @@
datasetPath = new Path(datasetName);
} catch (OptionException e) {
- System.err.println("Exception : " + e);
+ log.error("Error while parsing options", e);
CommandLineUtil.printHelp(group);
return -1;
}
@@ -205,8 +205,7 @@
return forest;
}
- protected static Data loadData(Configuration conf, Path dataPath, Dataset dataset)
- throws Exception {
+ protected static Data loadData(Configuration conf, Path dataPath, Dataset dataset) throws IOException {
log.info("Loading the data...");
FileSystem fs = dataPath.getFileSystem(conf);
Data data = DataLoader.loadData(dataset, fs, dataPath);
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/DeliciousTagsExample.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/DeliciousTagsExample.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/DeliciousTagsExample.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/DeliciousTagsExample.java Wed Feb 10 00:03:16 2010
@@ -85,12 +85,10 @@
params.set("selectedFieldCount", "1");
params.set("field0", "3");
params.set("maxTransactionLength", "100");
- KeyBasedStringTupleGrouper dataGrouper = new KeyBasedStringTupleGrouper();
- dataGrouper.startJob(params);
+ KeyBasedStringTupleGrouper.startJob(params);
} catch (OptionException ex) {
CommandLineUtil.printHelp(group);
- return;
}
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleGrouper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleGrouper.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleGrouper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/fpm/pfpgrowth/dataset/KeyBasedStringTupleGrouper.java Wed Feb 10 00:03:16 2010
@@ -50,6 +50,9 @@
public class KeyBasedStringTupleGrouper {
+ private KeyBasedStringTupleGrouper() {
+ }
+
public static void startJob(Parameters params) throws IOException,
InterruptedException, ClassNotFoundException {
Configuration conf = new Configuration();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/CDGA.java Wed Feb 10 00:03:16 2010
@@ -167,7 +167,7 @@
printElapsedTime(end - start);
} catch (OptionException e) {
- System.err.println("Exception : " + e);
+ log.error("Error while parsing options", e);
CommandLineUtil.printHelp(group);
}
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/ga/watchmaker/cd/tool/CDInfosTool.java Wed Feb 10 00:03:16 2010
@@ -254,7 +254,7 @@
log.info("Storing Descriptions...");
storeDescriptions(fs, inpath, descriptors, descriptions);
} catch (OptionException e) {
- System.err.println("Exception : " + e);
+ log.error("Error while parsing options", e);
CommandLineUtil.printHelp(group);
}
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SequenceFilesFromDirectory.java Wed Feb 10 00:03:16 2010
@@ -23,7 +23,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
-import java.util.Iterator;
import org.apache.commons.cli2.CommandLine;
import org.apache.commons.cli2.Group;
@@ -52,7 +51,7 @@
*/
public final class SequenceFilesFromDirectory {
- private ChunkedWriter createNewChunkedWriter(int chunkSizeInMB,
+ private static ChunkedWriter createNewChunkedWriter(int chunkSizeInMB,
String outputDir) throws IOException {
return new ChunkedWriter(chunkSizeInMB, outputDir);
}
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/SparseVectorsFromSequenceFiles.java Wed Feb 10 00:03:16 2010
@@ -138,7 +138,7 @@
analyzerClass.newInstance();
}
- boolean processIdf = false;
+ boolean processIdf;
if (cmdLine.hasOption(weightOpt)) {
String wString = cmdLine.getValue(weightOpt).toString();
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaMapper.java Wed Feb 10 00:03:16 2010
@@ -64,20 +64,22 @@
Reporter reporter) throws IOException {
String content = value.toString();
- if (content.contains(REDIRECT)) return;
- String document = "";
- String title = "";
+ if (content.contains(REDIRECT))
+ return;
+ String document;
+ String title;
try {
document = getDocument(content);
title = getTitle(content);
- } catch (Exception e) {
+ } catch (RuntimeException e) {
reporter.getCounter("Wikipedia", "Parse errors").increment(1);
return;
}
if (!all) {
String catMatch = findMatchingCategory(document);
- if (catMatch.equals("Unknown")) return;
+ if (catMatch.equals("Unknown"))
+ return;
}
document = StringEscapeUtils.unescapeHtml(document);
Modified: lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java?rev=908289&r1=908288&r2=908289&view=diff
==============================================================================
--- lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java (original)
+++ lucene/mahout/trunk/examples/src/main/java/org/apache/mahout/text/WikipediaToSequenceFile.java Wed Feb 10 00:03:16 2010
@@ -206,7 +206,7 @@
}
Set<String> categories = new HashSet<String>();
- if (catFile.equals("") == false) {
+ if (catFile.length() > 0) {
for (String line : new FileLineIterable(new File(catFile))) {
categories.add(line.trim().toLowerCase());
}