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

You lost slice[WARMUP_SAMPLES] item #6

Merged
merged 1 commit into from Jun 27, 2016
Merged

You lost slice[WARMUP_SAMPLES] item #6

merged 1 commit into from Jun 27, 2016

Conversation

aQuaYi
Copy link
Contributor

@aQuaYi aQuaYi commented Jun 24, 2016

原程序丢失了计算序列中的slice[WARMUP_SAMPLES]项。

package main

import (
"fmt"

"github.com/VividCortex/ewma"

)

func main() {
samples := [12]float64{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10000, 11}

e := ewma.NewMovingAverage()  //=> Returns a SimpleEWMA if called without params
a := ewma.NewMovingAverage(5) //=> returns a VariableEWMA with a decay of 2 / (5 + 1)

for _, f := range samples {
    e.Add(f)
    a.Add(f)
}

fmt.Println(e.Value())   //606.8771523549624
fmt.Println(a.Value())   //6.666666666666667

}

原程序丢失了计算序列中的slice[WARMUP_SAMPLES]项。
@Preetam Preetam self-assigned this Jun 27, 2016
@Preetam
Copy link
Contributor

Preetam commented Jun 27, 2016

LGTM 👍

Thanks!

@Preetam Preetam merged commit 054d1ae into VividCortex:master Jun 27, 2016
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

Successfully merging this pull request may close these issues.

None yet

2 participants