tfidf_vectorizer {kmers} R Documentation

make the sequence embedding via the TF-IDF weight of the bag-of-k-mers

Description

model

Usage

tfidf_vectorizer(x,
    type = Protein,
    k = 6,
    L2.norm = FALSE);

Arguments

x

should be a collection of the @T:SMRUCC.genomics.SequenceModel.FASTA.FastaSeq

type

[as SeqTypes]

k

[as integer]

L2.norm

[as boolean]

env

[as Environment]

Details

make sequence embedding via TF-IDF algorithm which is implemented via KmerTFIDFVectorizer

the generated embedding vector of each sequence will be normalized to an unit vector when the L2_norm parameter is TRUE, which is helpful for the cosine similarity or euclidean distance measurement between the embedding vectors of the different length sequences.

Authors

seqtoolkit

Value

a data frame object: each row is a sequence in the input sequence collection(the row name is the fasta title of the corresponding sequence), and each column is a k-mer term, the cell value is the TF-IDF weight of the corresponding k-mer in the corresponding sequence.

this function returns NULL if the input data can not be cast to a fasta sequence collection.

clr value class

Examples


[Package kmers version 1.0.0.0 Index]