Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/7884#discussion_r39435580
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/stat/MultivariateOnlineSummarizer.scala
---
@@ -158,28 +174,28 @@ class MultivariateOnlineSummarizer extends
MultivariateStatisticalSummary with S
*/
@Since("1.1.0")
override def mean: Vector = {
- require(totalCnt > 0, s"Nothing has been added to this summarizer.")
+ require(weightSum > 0, s"Nothing has been added to this summarizer.")
val realMean = Array.ofDim[Double](n)
var i = 0
while (i < n) {
- realMean(i) = currMean(i) * (nnz(i) / totalCnt)
+ realMean(i) = currMean(i) * (nnz(i) / weightSum)
i += 1
}
Vectors.dense(realMean)
}
/**
- * Sample variance of each dimension.
+ * Sample unbiased estimation of variance of each dimension.
--- End diff --
Change to: "Unbiased estimate of sample variance"
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]