mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r1455182 - /mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/common/PartialVectorMergeReducer.java
Date Mon, 11 Mar 2013 15:27:54 GMT
Author: ssc
Date: Mon Mar 11 15:27:54 2013
New Revision: 1455182

URL: http://svn.apache.org/r1455182
Log:
MAHOUT-1031 Drop empty vectors in encoding pipeline

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/common/PartialVectorMergeReducer.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/common/PartialVectorMergeReducer.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/common/PartialVectorMergeReducer.java?rev=1455182&r1=1455181&r2=1455182&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/common/PartialVectorMergeReducer.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/vectorizer/common/PartialVectorMergeReducer.java
Mon Mar 11 15:27:54 2013
@@ -67,9 +67,12 @@ public class PartialVectorMergeReducer e
     if (namedVector) {
       vector = new NamedVector(vector, key.toString());
     }
-    
-    VectorWritable vectorWritable = new VectorWritable(vector);
-    context.write(key, vectorWritable);
+
+    // drop empty vectors.
+    if (vector.getNumNondefaultElements() > 0) {
+      VectorWritable vectorWritable = new VectorWritable(vector);
+      context.write(key, vectorWritable);
+    }
   }
 
   @Override



Mime
View raw message