| tfidf_vectorizer {kmers} | R Documentation |
model
tfidf_vectorizer(x,
type = Protein,
k = 6,
L2.norm = FALSE);
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.
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.