Skip to content

Commit

Permalink
ColumnStatisticsAggregator doesn't merge mean correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxr committed Dec 30, 2014
1 parent 78157d4 commit ae9b94a
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,21 +136,19 @@ private class ColumnStatisticsAggregator(private val n: Int)

var i = 0
while (i < n) {
// merge mean together
if (other.currMean(i) != 0.0) {
if (nnz(i) + other.nnz(i) != 0.0) {
// merge mean together
currMean(i) = (currMean(i) * nnz(i) + other.currMean(i) * other.nnz(i)) /
(nnz(i) + other.nnz(i))
}
// merge m2n together
if (nnz(i) + other.nnz(i) != 0.0) {
// merge m2n together
currM2n(i) += other.currM2n(i) + deltaMean(i) * deltaMean(i) * nnz(i) * other.nnz(i) /
(nnz(i) + other.nnz(i))
}
if (currMax(i) < other.currMax(i)) {
currMax(i) = other.currMax(i)
}
if (currMin(i) > other.currMin(i)) {
currMin(i) = other.currMin(i)
if (currMax(i) < other.currMax(i)) {
currMax(i) = other.currMax(i)
}
if (currMin(i) > other.currMin(i)) {
currMin(i) = other.currMin(i)
}
}
i += 1
}
Expand Down

0 comments on commit ae9b94a

Please sign in to comment.