joshday / OnlineStats.jl

⚡ Single-pass algorithms for statistics
https://joshday.github.io/OnlineStats.jl/latest/
MIT License
831 stars 62 forks source link

ExtremeValues doesn't work #274

Closed LexaLutyi closed 6 months ago

LexaLutyi commented 7 months ago

Hi!

I'm using probably new feature: ExtremeValues, and I think it doesn't work:

extr = OnlineStats.ExtremeValues(Int)
fit!(extr, [1, 1, 1])
# ExtremeValues: n=3 | value=(lo = [1=>1, 1=>1, 1=>1], hi = [1=>1, 1=>1, 1=>1])

I expect

# ExtremeValues: n=3 | value=(lo = [1=>3], hi = [1=>3])

Do I miss something? Or is it not implemented yet?

Thank you!

joshday commented 7 months ago

Ah, looks like a bug/uncovered edge case.

joshday commented 6 months ago

Fixed in the latest release of OnlineStatsBAse. Note that there's a breaking change: values are stored as OrderedDict{T,Int} rather than Vector{Pair{T,Int}}.