Generate embeddings of given visits, contained in two named vectors. One vector contains the descriptions of interviews and the second -- the descriptions of examinations. This function interatively calls embed_visit function.

embed_list_visits(inter_descriptions, exam_descriptions,
  inter_term_vectors, exam_term_vectors)

Arguments

inter_descriptions

A vector of descriptions of interviews, named by visits' IDs; terms in the descriptions are separated by ", "

exam_descriptions

A vector of descriptions of examinations, named by visits' IDs; the visits' IDs do not have to be identical to inter_descriptions

inter_term_vectors

A matrix of embeddings of the interview terms

exam_term_vectors

A matrix of embeddings of the examination terms

Value

A matrix of embeddings of visits -- in each row there is an embedding of one visit.

See also

Examples

inter_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)))
exam_term_vectors <- embed_terms(examinations, embedding_size = 10L, term_count_min = 1L)
#> Error in .subset2(public_bind_env, "initialize")(...): unused arguments (word_vectors_size = 10, vocabulary = list(c("fever", "man", "mother", "cough", "heart", "patient", "thyroid", "eye", "rhinitis", "woman", "father"), c(2, 2, 2, 3, 3, 3, 3, 4, 5, 6, 7), c(2, 2, 2, 3, 3, 3, 3, 4, 5, 6, 7)))
visits_vectors <- embed_list_visits(interviews, examinations, inter_term_vectors, exam_term_vectors)
#> Error in ncol(term_vectors): object 'inter_term_vectors' not found
nrow(visits_vectors)
#> Error in nrow(visits_vectors): object 'visits_vectors' not found
visits_vectors
#> Error in eval(expr, envir, enclos): object 'visits_vectors' not found
visits_vectors[is.na(visits_vectors)] <- 0
#> Error in visits_vectors[is.na(visits_vectors)] <- 0: object 'visits_vectors' not found
D <- as.matrix(dist(visits_vectors))
#> Error in as.matrix(x): object 'visits_vectors' not found
# Two closest visits examinations[rownames(which(D == min(D[D > 0]), arr.ind = TRUE))]
#> Error in D > 0: comparison (6) is possible only for atomic and list types
visits_vectors <- embed_list_visits(interviews, "", inter_term_vectors, exam_term_vectors)
#> Error in ncol(term_vectors): object 'inter_term_vectors' not found
nrow(visits_vectors)
#> Error in nrow(visits_vectors): object 'visits_vectors' not found
visits_vectors
#> Error in eval(expr, envir, enclos): object 'visits_vectors' not found