OnlineStats.jl
OnlineStats.jl copied to clipboard
Traditional statistical weighting
trafficstars
Add the option to put in StatsBase-like weights.
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
?
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.
I really would like to have this!
This is still WIP: https://github.com/gdkrmr/WeightedOnlineStats.jl
I would love this too... @gdkrmr, gonna try and use your WeightedOnlineStats.jl