OnlineStats.jl icon indicating copy to clipboard operation
OnlineStats.jl copied to clipboard

Traditional statistical weighting

Open joshday opened this issue 7 years ago • 5 comments
trafficstars

Add the option to put in StatsBase-like weights.

joshday avatar Aug 08 '18 16:08 joshday

Continuing #131: So the rough plan would be to have

struct OnlineWeight <: Weight end
    total_weight::Float64
end

function fit!(stat::MyMean{OnlineWeight}, obs, wt)
    total_weight = stat.weight.total_weight + wt
    μ = stat.μ * (total_weight - wt)/wt + obs * wt/total_weight
    stat.μ = μ
    stat.weight.total_weight = total_weight
    stat.n += 1
end

?

jw3126 avatar Sep 08 '18 19:09 jw3126

The biggest hurdle is that an OnlineStats.Weight is a fundamentally different thing than StatsBase.AbstractWeights. I'll need to think through it more, but I probably won't have time this week.

joshday avatar Sep 10 '18 12:09 joshday

I really would like to have this!

gdkrmr avatar Oct 27 '18 09:10 gdkrmr

This is still WIP: https://github.com/gdkrmr/WeightedOnlineStats.jl

gdkrmr avatar Nov 05 '18 10:11 gdkrmr

I would love this too... @gdkrmr, gonna try and use your WeightedOnlineStats.jl

yakir12 avatar Nov 09 '18 21:11 yakir12