You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sm...@apache.org on 2015/09/09 01:26:41 UTC
mahout git commit: MAHOUT-1771 Cluster dumper omits indices and 0
elements for dense vector or sparse containing 0s closes apache/mahout #158
Repository: mahout
Updated Branches:
refs/heads/master d177b0a48 -> 77be783e8
MAHOUT-1771 Cluster dumper omits indices and 0 elements for dense vector or sparse containing 0s closes apache/mahout #158
Project: http://git-wip-us.apache.org/repos/asf/mahout/repo
Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/77be783e
Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/77be783e
Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/77be783e
Branch: refs/heads/master
Commit: 77be783e845dec2f7bf0f90cc693a86bb9ab001a
Parents: d177b0a
Author: smarthi <sm...@apache.org>
Authored: Tue Sep 8 19:25:56 2015 -0400
Committer: smarthi <sm...@apache.org>
Committed: Tue Sep 8 19:25:56 2015 -0400
----------------------------------------------------------------------
mr/src/main/java/org/apache/mahout/clustering/AbstractCluster.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mahout/blob/77be783e/mr/src/main/java/org/apache/mahout/clustering/AbstractCluster.java
----------------------------------------------------------------------
diff --git a/mr/src/main/java/org/apache/mahout/clustering/AbstractCluster.java b/mr/src/main/java/org/apache/mahout/clustering/AbstractCluster.java
index 86fa011..be7ed2a 100644
--- a/mr/src/main/java/org/apache/mahout/clustering/AbstractCluster.java
+++ b/mr/src/main/java/org/apache/mahout/clustering/AbstractCluster.java
@@ -353,7 +353,7 @@ public abstract class AbstractCluster implements Cluster {
public static List<Object> formatVectorAsJson(Vector v, String[] bindings) throws IOException {
boolean hasBindings = bindings != null;
- boolean isSparse = !v.isDense() && v.getNumNondefaultElements() != v.size();
+ boolean isSparse = v.getNumNonZeroElements() != v.size();
// we assume sequential access in the output
Vector provider = v.isSequentialAccess() ? v : new SequentialAccessSparseVector(v);