-
Notifications
You must be signed in to change notification settings - Fork 401
Closed
Labels
kind/bugSomething isn't workingSomething isn't working
Description
Describe the bug
the code under pkg/prediction/dsp/estimators.go
func (m *maxValueEstimator) GetEstimation(signal *Signal, periodLength time.Duration) *Signal {
nSamplesPerPeriod := int(periodLength.Seconds() * signal.SampleRate)
estimation := make([]float64, 0, nSamplesPerPeriod)
nSamples := len(signal.Samples)
nPeriods := nSamples / nSamplesPerPeriod
for i := nSamples - nSamplesPerPeriod; i < nSamples; i++ {
maxValue := signal.Samples[i]
for j := 1; j < nPeriods; j++ {
if maxValue < signal.Samples[i-nSamplesPerPeriod*j] {
maxValue = signal.Samples[i-nSamplesPerPeriod*j]
}
}
estimation = append(estimation, maxValue*(1.0+m.marginFraction))
}
return &Signal{
SampleRate: signal.SampleRate,
Samples: estimation,
}
}
Is that right use for j := 1; j < nPeriods; j++ {
.From the introduce in https://gocrane.io/zh-cn/docs/core-concept/timeseries-forecasting-by-dsp/ seems that why should use for j := 1; j <= nPeriods; j++ {
.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working