mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pran...@apache.org
Subject svn commit: r1302100 - /mahout/trunk/core/src/main/java/org/apache/mahout/clustering/classify/ClusterClassificationMapper.java
Date Sun, 18 Mar 2012 09:09:57 GMT
Author: pranjan
Date: Sun Mar 18 09:09:57 2012
New Revision: 1302100

URL: http://svn.apache.org/viewvc?rev=1302100&view=rev
Log:
Mahout-981, Changed key to WritableComparable<?> to fix the reuters examples build.
Now any type can be feeded as a key in the input sequence file.

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/clustering/classify/ClusterClassificationMapper.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/classify/ClusterClassificationMapper.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/classify/ClusterClassificationMapper.java?rev=1302100&r1=1302099&r2=1302100&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/classify/ClusterClassificationMapper.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/classify/ClusterClassificationMapper.java
Sun Mar 18 09:09:57 2012
@@ -31,8 +31,8 @@ import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.IntWritable;
-import org.apache.hadoop.io.LongWritable;
 import org.apache.hadoop.io.Writable;
+import org.apache.hadoop.io.WritableComparable;
 import org.apache.hadoop.mapreduce.Mapper;
 import org.apache.mahout.clustering.Cluster;
 import org.apache.mahout.clustering.dirichlet.DirichletCluster;
@@ -48,7 +48,7 @@ import org.apache.mahout.math.VectorWrit
  * Mapper for classifying vectors into clusters.
  */
 public class ClusterClassificationMapper extends
-    Mapper<IntWritable,VectorWritable,IntWritable,WeightedVectorWritable> {
+    Mapper<WritableComparable<?>,VectorWritable,IntWritable,WeightedVectorWritable>
{
   
   private static double threshold;
   private List<Cluster> clusterModels;
@@ -84,7 +84,7 @@ public class ClusterClassificationMapper
    * Mapper which classifies the vectors to respective clusters.
    */
   @Override
-  protected void map(IntWritable key, VectorWritable vw, Context context)
+  protected void map(WritableComparable<?> key, VectorWritable vw, Context context)
       throws IOException, InterruptedException {
     if (!clusterModels.isEmpty()) {
       Vector pdfPerCluster = clusterClassifier.classify(vw.get());



Mime
View raw message