Created
April 8, 2020 21:43
-
-
Save codingsnap/7357fd9bf8212fcdfa3c750216e8ab63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hoe many elements LSTM input should consider | |
sequence_length = 100 | |
# All unique classes | |
pitchnames = sorted(set(notes)) | |
# Mapping between ele to int value | |
ele_to_int = dict( (ele, num) for num, ele in enumerate(pitchnames) ) | |
network_input = [] | |
network_output = [] | |
for i in range(len(notes) - sequence_length): | |
seq_in = notes[i : i+sequence_length] # contains 100 values | |
seq_out = notes[i + sequence_length] | |
network_input.append([ele_to_int[ch] for ch in seq_in]) | |
network_output.append(ele_to_int[seq_out]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment