You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by ro...@apache.org on 2010/02/14 01:19:31 UTC

svn commit: r909938 - in /lucene/mahout/trunk/core/src: main/java/org/apache/mahout/clustering/canopy/ test/java/org/apache/mahout/clustering/canopy/

Author: robinanil
Date: Sun Feb 14 00:19:31 2010
New Revision: 909938

URL: http://svn.apache.org/viewvc?rev=909938&view=rev
Log:
CanopyClusterer now reports status information

Modified:
    lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusterer.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/ClusterMapper.java
    lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/TestCanopyCreation.java

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusterer.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusterer.java?rev=909938&r1=909937&r2=909938&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusterer.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/CanopyClusterer.java Sun Feb 14 00:19:31 2010
@@ -154,10 +154,13 @@
    *          the List<Canopy> to be appended
    * @param collector
    *          an OutputCollector in which to emit the point
+   * @param reporter
+   *          to report status of the job
    */
   public void emitPointToExistingCanopies(Vector point,
                                           List<Canopy> canopies,
-                                          OutputCollector<Text,VectorWritable> collector) throws IOException {
+                                          OutputCollector<Text,VectorWritable> collector,
+                                          Reporter reporter) throws IOException {
     double minDist = Double.MAX_VALUE;
     Canopy closest = null;
     boolean isCovered = false;
@@ -168,6 +171,7 @@
         isCovered = true;
         vw.set(point);
         collector.collect(new Text(canopy.getIdentifier()), vw);
+        reporter.setStatus("Emit Canopy ID:" +canopy.getIdentifier());
       } else if (dist < minDist) {
         minDist = dist;
         closest = canopy;
@@ -178,6 +182,7 @@
     vw.set(point);
     if (!isCovered) {
       collector.collect(new Text(closest.getIdentifier()), vw);
+      reporter.setStatus("Emit Closest Canopy ID:" + closest.getIdentifier());
     }
   }
   

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=909938&r1=909937&r2=909938&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 Sun Feb 14 00:19:31 2010
@@ -47,7 +47,7 @@
   
   private static final Logger log = LoggerFactory.getLogger(CanopyDriver.class);
   
-  private CanopyDriver() { }
+  private CanopyDriver() {}
   
   public static void main(String[] args) throws IOException {
     DefaultOptionBuilder obuilder = new DefaultOptionBuilder();
@@ -129,10 +129,10 @@
    * @param t2
    *          the T2 distance threshold
    */
-  public static void runJob(String input, String output, String measureClassName, double t1, double t2) throws IOException {
-    CanopyDriver.log.info("Input: {} Out: {} Measure: {} t1: {} t2: {}", new Object[] {input, output,
-                                                                                       measureClassName, t1,
-                                                                                       t2});
+  public static void runJob(String input, String output,
+                            String measureClassName, double t1, double t2) throws IOException {
+    CanopyDriver.log.info("Input: {} Out: {} " 
+      + "Measure: {} t1: {} t2: {}", new Object[] {input, output, measureClassName, t1, t2});
     Configurable client = new JobClient();
     JobConf conf = new JobConf(CanopyDriver.class);
     conf.set(CanopyConfigKeys.DISTANCE_MEASURE_KEY, measureClassName);

Modified: lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterMapper.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterMapper.java?rev=909938&r1=909937&r2=909938&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterMapper.java (original)
+++ lucene/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/canopy/ClusterMapper.java Sun Feb 14 00:19:31 2010
@@ -45,7 +45,7 @@
                   VectorWritable point,
                   OutputCollector<Text,VectorWritable> output,
                   Reporter reporter) throws IOException {
-    canopyClusterer.emitPointToExistingCanopies(point.get(), canopies, output);
+    canopyClusterer.emitPointToExistingCanopies(point.get(), canopies, output, reporter);
   }
   
   /**

Modified: lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/TestCanopyCreation.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/TestCanopyCreation.java?rev=909938&r1=909937&r2=909938&view=diff
==============================================================================
--- lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/TestCanopyCreation.java (original)
+++ lucene/mahout/trunk/core/src/test/java/org/apache/mahout/clustering/canopy/TestCanopyCreation.java Sun Feb 14 00:19:31 2010
@@ -593,7 +593,7 @@
     List<VectorWritable> points = getPoints(raw);
     // map the data
     for (VectorWritable point : points) {
-      mapper.map(new Text(), point, collector, null);
+      mapper.map(new Text(), point, collector, new DummyReporter());
     }
     Map<String, List<VectorWritable>> data = collector.getData();