Description Usage Arguments Value See Also Examples
View source: R/visit_embeddings.R
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.
1 2 | embed_list_visits(inter_descriptions, exam_descriptions,
inter_term_vectors, exam_term_vectors)
|
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 |
A matrix of embeddings of visits – in each row there is an embedding of one visit.
embed_visit
, embed_description
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | inter_term_vectors <- embed_terms(interviews, embedding_size = 10L,
term_count_min = 1L)
exam_term_vectors <- embed_terms(examinations, embedding_size = 10L,
term_count_min = 1L)
visits_vectors <- embed_list_visits(interviews,
examinations,
inter_term_vectors, exam_term_vectors)
nrow(visits_vectors)
visits_vectors
visits_vectors[is.na(visits_vectors)] <- 0
D <- as.matrix(dist(visits_vectors))
# Two closest visits
examinations[rownames(which(D == min(D[D > 0]),
arr.ind = TRUE))]
visits_vectors <- embed_list_visits(interviews, "",
inter_term_vectors, exam_term_vectors)
nrow(visits_vectors)
visits_vectors
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.