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

reset or clear a stats

Open yakir12 opened this issue 5 years ago • 4 comments
trafficstars

Say I create a vector of Means. After using that structure, if I want to use it again, I'd need to reset its values first. Right now I need to recreate that structure again. This might be useful only in cases where the structure is really complicated/large.

yakir12 avatar May 08 '20 14:05 yakir12

I've thought about having Base.empty! methods that reset the state. I'm hesitant to add empty! as a required method to the OnlineStatsBase interface, but it would be nice to have those methods around.

joshday avatar May 08 '20 15:05 joshday

Just adding my voice to the choir: it would be pretty nice to have empty! for OnlineStat:)

torfjelde avatar Sep 20 '20 22:09 torfjelde

+1 for this. I'd like to use OnlineStats with Distributed.jl by having local stat objects on each processor, and then periodically merge! them onto stat objects on the driver. Then I'd like to empty the local objects to continue to accumulate stats on each processor. (For https://github.com/ericphanson/TrackingTimers.jl/issues/14). I think this would be much nicer with an empty! method.

ericphanson avatar Dec 24 '21 18:12 ericphanson

Base.empty!(::OnlineStat) is an error, but I've added it as an optional part of the interface (via the OnlineStatsBase README).

If anyone wants to knock out a few methods, PRs welcome.

joshday avatar Jan 18 '22 13:01 joshday