Description Usage Arguments Value Examples
View source: R/visualize_embeddings.R
Display a 2D PCA plot of a collection of embedding vectors.
1 2 3 4 5 6 | display_pca(
embedding_df,
project_vectors = embedding_df,
color_field = NULL,
disambiguate_tokens = TRUE
)
|
embedding_df |
A tbl_df of embedding vectors; from the output of
|
project_vectors |
A tbl_df of embedding vectors to be used for
calculating the PCA projection matrix. Defaults to |
color_field |
Character scalar; optional column name to assign to color aesthetic in the plot. |
disambiguate_tokens |
Logical; whether to append example and token index to the literal token for display purposes. |
A ggplot2 plot of the embedding vectors projected onto two principal axes.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
# assuming something like the following has been run:
# feats <- RBERT::extract_features(...) # See RBERT documentation
# Then:
feats$output %>%
filter_layer_embeddings(layer_indices = 12L) %>%
keep_tokens("[CLS]") %>%
display_pca()
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.