visualize_attention: Visualize BERT Attention Weights

Description Usage Arguments Value Examples

View source: R/visualize_attention.R

Description

Given data from an RBERT model, display an interactive visualization of the attention weights.

Usage

1
2
3
4
5
6
7
visualize_attention(
  attention,
  sequence_index = 1,
  width = NULL,
  height = NULL,
  elementId = NULL
)

Arguments

attention

The "attention" component of the output from extract_features(..., features = "attention").

sequence_index

Integer; which example sequence from the input to visualize.

height, width

Characters; height and width of the htmlwidget specified in any valid CSS size unit.

elementId

Character; a valid CSS element id.

Value

the output from htmlwidgets::createWidget.

Examples

1
2
3
4
5
6
7
## Not run: 
# assuming something like the following has been run:
# feats <- RBERT::extract_features(...) # See RBERT documentation
# Then:
visualize_attention(feats$attention)

## End(Not run)

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