Skip to content

Instantly share code, notes, and snippets.

@Kcrong
Created February 3, 2018 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kcrong/1754647e69d30f2b6a64e052bc01076a to your computer and use it in GitHub Desktop.
Save Kcrong/1754647e69d30f2b6a64e052bc01076a to your computer and use it in GitHub Desktop.
def seq2dataset(seq, window_size):
dataset = []
for i in range(len(seq)-window_size):
subset = seq[i:(i+window_size+1)]
dataset.append([code2idx[item] for item in subset])
return np.array(dataset)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment