From 0e2e029e9cd74fce78a0de3a434ef60e5d8f22fe Mon Sep 17 00:00:00 2001 From: joshday Date: Sat, 20 Jun 2020 16:30:35 -0400 Subject: [PATCH] fix mean while we're at it --- src/stats.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stats.jl b/src/stats.jl index cbb039d..65f5a37 100644 --- a/src/stats.jl +++ b/src/stats.jl @@ -340,7 +340,7 @@ mutable struct Mean{T,W} <: OnlineStat{Number} end Mean(T::Type{<:Number} = Float64; weight = EqualWeight()) = Mean(zero(T), weight, 0) function _fit!(o::Mean{T}, x) where {T} - o.μ = (o.n += 1) == 1 ? x : smooth(o.μ, x, T(o.weight(o.n))) + o.μ = smooth(o.μ, x, T(o.weight(o.n += 1))) end function _merge!(o::Mean, o2::Mean) o.n += o2.n