Skip to content

Instantly share code, notes, and snippets.

@codingsnap
Created April 8, 2020 21:48
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 codingsnap/9d26614348bc35f84ee6ae549c929acb to your computer and use it in GitHub Desktop.
Save codingsnap/9d26614348bc35f84ee6ae549c929acb to your computer and use it in GitHub Desktop.
# No. of examples
n_patterns = len(network_input)
print(n_patterns)
# Desired shape for LSTM
network_input = np.reshape(network_input, (n_patterns, sequence_length, 1))
print(network_input.shape)
normalised_network_input = network_input/float(n_vocab)
# Network output are the classes, encode into one hot vector
network_output = np_utils.to_categorical(network_output)
network_output.shape #Output: (60398, 359)
print(normalised_network_input.shape) #Output: (60398, 100, 1)
print(network_output.shape) #Output: (60398, 359)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment