Skip to content

Instantly share code, notes, and snippets.

@WillKoehrsen
Last active November 5, 2018 00:10
Show Gist options
  • Save WillKoehrsen/de03f3c43bea34111ce1948c0c0bd9ba to your computer and use it in GitHub Desktop.
Save WillKoehrsen/de03f3c43bea34111ce1948c0c0bd9ba to your computer and use it in GitHub Desktop.
features = []
labels = []
training_length = 50
# Iterate through the sequences of tokens
for seq in sequences:
# Create multiple training examples from each sequence
for i in range(training_length, len(seq)):
# Extract the features and label
extract = seq[i - training_length:i + 1]
# Set the features and label
features.append(extract[:-1])
labels.append(extract[-1])
features = np.array(features)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment