Created
October 16, 2019 08:35
-
-
Save irdanish11/99841a2d79c4ab4fa0904409d8556ba7 to your computer and use it in GitHub Desktop.
Splits the sequences into inputs and output labels for our model. As sequence length was 4, we use first three words and for that three words model will predict the word. The fourth word will be used as label. After that we convert our output labels into one hot vectors i.e into combinations of 0's and 1.
This file contains hidden or 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
| train_inputs = n_sequences[:,:-1] | |
| train_targets = n_sequences[:,-1] | |
| train_targets = to_categorical(train_targets, num_classes=vocabulary_size+1) | |
| seq_len = train_inputs.shape[1] | |
| train_inputs.shape |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment