Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant