Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

ExpDecaySample.Update - problem with rand.Float64() divider #281

Open
LopatkinEvgeniy opened this issue Feb 18, 2021 · 0 comments
Open

ExpDecaySample.Update - problem with rand.Float64() divider #281

LopatkinEvgeniy opened this issue Feb 18, 2021 · 0 comments

Comments

@LopatkinEvgeniy
Copy link

LopatkinEvgeniy commented Feb 18, 2021

There is a code:

func (s *ExpDecaySample) update(t time.Time, v int64) {
// ...

	s.values.Push(expDecaySample{
		k: math.Exp(t.Sub(s.t0).Seconds()*s.alpha) / rand.Float64(),
		v: v,
	})

// ...
{

If rand.Float64() will return zero then the "k" value will be Inf. So this value will never be dropped (until rescale). This will increase the error of the results. Maybe division by random number is not a good idea?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant