View source: R/plot_alignment.R
plot_beta | R Documentation |
This function plots the \beta_{kd}^{m}
topic parameters across models
m
, topics k
, and dimensions d
. It takes as input a raw
alignment object and then returns a circle heatmap. The size of each circle
corresponds to the value \beta_{kd}^m
for the model in panel m
,
topic in column k
, and dimension in row d
. The plot can be
restricted to only a subset of models by using the models
argument,
which may be either a vector of model names or numeric indices into the list
of models. The dimensions can be filtered by using the n_features
or
min_beta
arguments – by default, only dimensions with at least one
topic satisfying \beta_{kd}^m > 0.025
are displayed.
plot_beta(
x,
models = "all",
filter_by = "beta",
x_axis = "label",
threshold = 0.001,
n_features = NULL,
beta_aes = "size",
color_by = "path"
)
x |
(required) An alignment class object resulting from
|
models |
Which models to display in the heatmap? Defaults to
|
filter_by |
(optional, default = |
x_axis |
(optional, default = |
threshold |
(optional, default = 0.001) Words (features) with less than this average beta or distinctiveness across all topics are ignored |
n_features |
(optional) alternative to |
beta_aes |
Should word probabilities within a topic be encoded using
circle size ( |
color_by |
(optional) What should the color of topics and weights encode? Defaults to 'path'. Other possible arguments are 'coherence', 'refinement', or 'topic'. |
A ggplot2 object describing the word probabilities associated with each topic across models of interest.
library(purrr)
data <- rmultinom(10, 20, rep(0.1, 20))
lda_params <- setNames(map(1:5, ~ list(k = .)), 1:5)
lda_models <- run_lda_models(data, lda_params)
alignment <- align_topics(lda_models)
plot_beta(alignment)
plot_beta(alignment, models = c(3, 4))
plot_beta(alignment, models = "last")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.