Skip to content

gdkrmr/WeightedOnlineStats.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WeightedOnlineStats.jl

DOI CI codecov.io

An extension of OnlineStatsBase.jl that supports proper statistical weighting and arbitrary numerical precision.

Usage

using WeightedOnlineStats

values = rand(100)
weights = rand(100)

# fit using arrays:
o1 = fit!(WeightedMean(), values, weights)

# fit using an iterator that returns a tuple (value, weight):
o2 = fit!(WeightedMean(), zip(values, weights))

# fit single values at a time:
o3 = WeightedMean()
for i in 1:length(values)
    fit!(o3, values[i], weights[i])
end

mean(o1)
mean(o2)
mean(o3)

Statistics

WeightedOnlineStats.jl currently implements the following Statistics:

  • WeightedSum
  • WeightedMean
  • WeightedVariance
  • WeightedCovMatrix
  • WeightedHist
  • WeightedAdaptiveHist