int_to_n_gram: Encode sequence of integers to sequence of n-gram

int_to_n_gramR Documentation

Encode sequence of integers to sequence of n-gram

Description

Input is sequence of integers from vocabulary of size voc_size. Returns vector of integers corresponding to n-gram encoding. Integers greater than voc_size get encoded as voc_size^n + 1.

Usage

int_to_n_gram(int_seq, n, voc_size = 4)

Arguments

int_seq

Integer sequence

n

Length of n-gram aggregation

voc_size

Size of vocabulary.

Value

A numeric vector.

Examples

int_to_n_gram(int_seq = c(1,1,2,4,4), n = 2, voc_size = 4)


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