HoangTrungNguyen commited on
Commit
47aa70f
·
verified ·
1 Parent(s): bb6be84

Upload scripts/decode_reimplementation.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts/decode_reimplementation.py +6 -2
scripts/decode_reimplementation.py CHANGED
@@ -427,8 +427,12 @@ def make_lstm_sequences(np, split: SplitData, lookback: int):
427
  n_val = len(split.y_val)
428
 
429
  xs, ys, end_indices = [], [], []
430
- for end in range(lookback, len(y_all)):
431
- xs.append(x_all[end - lookback:end])
 
 
 
 
432
  ys.append(y_all[end])
433
  end_indices.append(end)
434
  xs = np.asarray(xs)
 
427
  n_val = len(split.y_val)
428
 
429
  xs, ys, end_indices = [], [], []
430
+ for end in range(lookback - 1, len(y_all)):
431
+ # Use the sequence ending at row `end` to predict that row's target.
432
+ # The target was already shifted by --horizon during feature engineering,
433
+ # so excluding row `end` here would make sequence models forecast one
434
+ # extra step farther than the baseline models.
435
+ xs.append(x_all[end - lookback + 1:end + 1])
436
  ys.append(y_all[end])
437
  end_indices.append(end)
438
  xs = np.asarray(xs)