diff options
author | WeichenXu <WeichenXu123@outlook.com> | 2016-09-03 09:52:53 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-09-03 09:52:53 +0100 |
commit | 7a8a81d79f4bee3395fb399ccc4d47744f8a0951 (patch) | |
tree | 0860e3bbf54445b90b372bcc814237c86d33d7a3 /mllib/src/main | |
parent | d2fde6b72c4aede2e7edb4a7e6653fb1e7b19924 (diff) | |
download | spark-7a8a81d79f4bee3395fb399ccc4d47744f8a0951.tar.gz spark-7a8a81d79f4bee3395fb399ccc4d47744f8a0951.tar.bz2 spark-7a8a81d79f4bee3395fb399ccc4d47744f8a0951.zip |
[SPARK-17363][ML][MLLIB] fix MultivariantOnlineSummerizer.numNonZeros
## What changes were proposed in this pull request?
fix `MultivariantOnlineSummerizer.numNonZeros` method,
return `nnz` array, instead of `weightSum` array
## How was this patch tested?
Existing test.
Author: WeichenXu <WeichenXu123@outlook.com>
Closes #14923 from WeichenXu123/fix_MultivariantOnlineSummerizer_numNonZeros.
Diffstat (limited to 'mllib/src/main')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateOnlineSummarizer.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateOnlineSummarizer.scala b/mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateOnlineSummarizer.scala index 964f419d12..7a2a7a35a9 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateOnlineSummarizer.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateOnlineSummarizer.scala @@ -231,9 +231,9 @@ class MultivariateOnlineSummarizer extends MultivariateStatisticalSummary with S */ @Since("1.1.0") override def numNonzeros: Vector = { - require(totalWeightSum > 0, s"Nothing has been added to this summarizer.") + require(totalCnt > 0, s"Nothing has been added to this summarizer.") - Vectors.dense(weightSum) + Vectors.dense(nnz.map(_.toDouble)) } /** |