Skip to content

Instantly share code, notes, and snippets.

@Axect
Created March 9, 2023 04:22
Show Gist options
  • Save Axect/a0a7433f4ff229a4367a16c19f8614c1 to your computer and use it in GitHub Desktop.
Save Axect/a0a7433f4ff229a4367a16c19f8614c1 to your computer and use it in GitHub Desktop.
def sliding_window(data, seq_length, pred_length):
x = []
y = []
for i in range(len(data) - seq_length - pred_length):
_x = data[i:(i+seq_length)]
_y = data[i+seq_length:i+seq_length+pred_length]
x.append(_x)
y.append(_y)
return np.array(x), np.array(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment