--- a +++ b/man/n_gram_of_matrix.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/preprocess.R +\name{n_gram_of_matrix} +\alias{n_gram_of_matrix} +\title{One-hot encoding matrix to n-gram encoding matrix} +\usage{ +n_gram_of_matrix(input_matrix, n = 3) +} +\arguments{ +\item{input_matrix}{Matrix with one 1 per row and zeros otherwise.} + +\item{n}{Length of one n-gram.} +} +\value{ +Matrix of one-hot encodings. +} +\description{ +One-hot encoding matrix to n-gram encoding matrix +} +\examples{ +\dontshow{if (reticulate::py_module_available("tensorflow")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +x <- c(0,0,1,3,3) +input_matrix <- keras::to_categorical(x, 4) +n_gram_of_matrix(input_matrix, n = 2) +\dontshow{\}) # examplesIf} +}