n_gram_of_matrix | R Documentation |
One-hot encoding matrix to n-gram encoding matrix
n_gram_of_matrix(input_matrix, n = 3)
input_matrix |
Matrix with one 1 per row and zeros otherwise. |
n |
Length of one n-gram. |
Matrix of one-hot encodings.
x <- c(0,0,1,3,3)
input_matrix <- keras::to_categorical(x, 4)
n_gram_of_matrix(input_matrix, n = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.