From aab848dbf25ef49e55b968d5d1b329787213d07d Mon Sep 17 00:00:00 2001 From: kevinroundy Date: Wed, 23 Apr 2025 12:16:53 -0700 Subject: [PATCH] Update train.go start needs to be replaced with y_start. --- forecast/algs/hw/train.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/forecast/algs/hw/train.go b/forecast/algs/hw/train.go index 24aef77..d082679 100644 --- a/forecast/algs/hw/train.go +++ b/forecast/algs/hw/train.go @@ -28,6 +28,8 @@ func (hw *HoltWinters) trainSeries(ctx context.Context, start, end int) error { ) y := hw.sf.Values[start : end+1] + y_start := 0 + y_end := len(y) - 1 seasonals := initialSeasonalComponents(y, period, hw.cfg.SeasonalMethod) @@ -39,14 +41,14 @@ func (hw *HoltWinters) trainSeries(ctx context.Context, start, end int) error { var mse float64 // mean squared error // Training smoothing Level - for i := start; i < end+1; i++ { + for i := y_start; i < y_end+1; i++ { if err := ctx.Err(); err != nil { return err } xt := y[i] - if i == start { // Set initial smooth + if i == y_start { // Set initial smooth st = xt hw.tstate.initialSmooth = xt } else {