n_gram_of_matrix: One-hot encoding matrix to n-gram encoding matrix

n_gram_of_matrixR Documentation

One-hot encoding matrix to n-gram encoding matrix

Description

One-hot encoding matrix to n-gram encoding matrix

Usage

n_gram_of_matrix(input_matrix, n = 3)

Arguments

input_matrix

Matrix with one 1 per row and zeros otherwise.

n

Length of one n-gram.

Value

Matrix of one-hot encodings.

Examples


x <- c(0,0,1,3,3) 
input_matrix <- keras::to_categorical(x, 4)
n_gram_of_matrix(input_matrix, n = 2) 


GenomeNet/deepG documentation built on Dec. 24, 2024, 12:11 p.m.