Open
Description
Some of the algorithms, like WeightedMean
and WeightedCovMatrix
, return NaN
values if the first weight is zero. Example:
using WeightedOnlineStats
m = WeightedMean()
x = ones(3)
w = [0.0, 0.5, 1.0]
fit!(m, x, w)
# WeightedMean: ∑wᵢ=1.5 | value=NaN
# but if we reverse the sequences everything works as expected:
m = WeightedMean()
fit!(m, reverse(x), reverse(w))
# WeightedMean: ∑wᵢ=1.5 | value=1.0
If at any point in the computation the sum of the previous weights, o.W
, becomes zero, there will be NaN
values because of division by zero. For the weighted mean this could be fixed by not changing mu
in that case.
Metadata
Metadata
Assignees
Labels
No labels