Compute a simple average of embeddings of given terms of a description. Only terms that have embeddings are included. If there are not such terms, the vector of NA is returned.

embed_description(description, term_vectors)

Arguments

description

A string of concatenated terms extracted from a visit, separated by ", "

term_vectors

A matrix of embeddings of the terms

Value

A vector of the embedding of the description.

See also

Examples

term_vectors <- embed_terms(interviews, embedding_size = 10L, term_count_min = 1L)
#> Error in .subset2(public_bind_env, "initialize")(...): unused arguments (word_vectors_size = 10, vocabulary = list(c("fever", "rhinitis", "cough", "eye", "thyroid"), c(3, 3, 4, 4, 6), c(3, 3, 4, 4, 6)))
embed_description("fever", term_vectors)
#> Error in ncol(term_vectors): object 'term_vectors' not found
embed_description("fever, cough", term_vectors)
#> Error in ncol(term_vectors): object 'term_vectors' not found
embed_description("fever, cough, temperature", term_vectors)
#> Error in ncol(term_vectors): object 'term_vectors' not found
embed_description("temperature", term_vectors)
#> Error in ncol(term_vectors): object 'term_vectors' not found