visualize_term_embeddings.Rd
Visualize given embeddings of terms of specified categories. The visualization is generated on the 2D plane by t-SNE algorithm or by PCA (two main components) and plotted with ggplot. If t-SNE cannot be generated (because for example perplexity is too large for the number of samples), there are plotted two main components from PCA. The plot can be optionally saved to the given PDF file.
visualize_term_embeddings(term_table, term_vectors, category, method = "tsne", save = FALSE, path_to_save)
term_table | A data frame with columns:
|
---|---|
term_vectors | A matrix of embeddings of the terms |
category | A character vector of categories of the terms to be visualized |
method | One of "tsne" (default) or "pca" - a method of generating the plot |
save | A logical indicating if the plot should be saved to the file |
path_to_save | An optional string of the path to the target PDF file |
A generated plot of embeddings.
#> 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)))visualize_term_embeddings(terms_categories, inter_term_vectors, unique(as.character(terms_categories$category)))#> Error in visualize_term_embeddings(terms_categories, inter_term_vectors, unique(as.character(terms_categories$category))): object 'inter_term_vectors' not found#> Error in visualize_term_embeddings(terms_categories, inter_term_vectors, c("anatomic"), method = "pca"): object 'inter_term_vectors' not found