You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by je...@apache.org on 2012/06/09 22:07:16 UTC

svn commit: r1348494 - in /mahout/trunk: examples/bin/cluster-reuters.sh integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java

Author: jeastman
Date: Sat Jun  9 20:07:16 2012
New Revision: 1348494

URL: http://svn.apache.org/viewvc?rev=1348494&view=rev
Log:
MAHOUT-1030: adding better null check when empty properties are written

Modified:
    mahout/trunk/examples/bin/cluster-reuters.sh
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java

Modified: mahout/trunk/examples/bin/cluster-reuters.sh
URL: http://svn.apache.org/viewvc/mahout/trunk/examples/bin/cluster-reuters.sh?rev=1348494&r1=1348493&r2=1348494&view=diff
==============================================================================
--- mahout/trunk/examples/bin/cluster-reuters.sh (original)
+++ mahout/trunk/examples/bin/cluster-reuters.sh Sat Jun  9 20:07:16 2012
@@ -20,7 +20,7 @@
 # Downloads the Reuters dataset and prepares it for clustering
 #
 # To run:  change into the mahout directory and type:
-#  examples/bin/build-reuters.sh
+#  examples/bin/cluster-reuters.sh
 
 if [ "$1" = "--help" ] || [ "$1" = "--?" ]; then
   echo "This script clusters the Reuters data set using a variety of algorithms.  The data set is downloaded automatically."

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java?rev=1348494&r1=1348493&r2=1348494&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java (original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java Sat Jun  9 20:07:16 2012
@@ -80,15 +80,15 @@ public class ClusterDumperWriter extends
           WeightedPropertyVectorWritable tmp = (WeightedPropertyVectorWritable) point;
           Map<Text,Text> map = tmp.getProperties();
           // map can be null since empty maps when written are returned as null
+          writer.write(" : [");
           if (map != null) {
-            writer.write(" : [");
             for (Map.Entry<Text,Text> entry : map.entrySet()) {
               writer.write(entry.getKey().toString());
               writer.write("=");
               writer.write(entry.getValue().toString());
             }
-            writer.write("]");
           }
+          writer.write("]");
         }
         
         writer.write(": ");