One-hot encoding matrix to n-gram encoding matrix
Examples
if (FALSE) { # reticulate::py_module_available("tensorflow")
x <- c(0,0,1,3,3)
input_matrix <- keras::to_categorical(x, 4)
n_gram_of_matrix(input_matrix, n = 2)
}
One-hot encoding matrix to n-gram encoding matrix
if (FALSE) { # reticulate::py_module_available("tensorflow")
x <- c(0,0,1,3,3)
input_matrix <- keras::to_categorical(x, 4)
n_gram_of_matrix(input_matrix, n = 2)
}