autoplot.rbert_pca: Plot PCA

Description Usage Arguments Value Examples

View source: R/visualize_embeddings.R

Description

Given the output of do_pca, make the plot object.

Usage

1
2
## S3 method for class 'rbert_pca'
autoplot(pca_df, color_field = NULL)

Arguments

pca_df

A tbl_df of pca vectors with class "rbert_pca"; output from a call to do_pca.

color_field

Character scalar; optional column name to assign to color aesthetic in the plot.

Value

A ggplot2 plot of the embedding vectors projected onto two principal axes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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]") %>%
    do_pca() %>%
    autoplot()

## End(Not run)

jonathanbratt/RBERTviz documentation built on June 19, 2021, 6:27 p.m.