Plot biterms as a clustered graph. The graph is constructed by assigning each word to a topic and within a topic of words biterm frequencies are shown.
textplot_bitermclusters(x, ...)# S3 method for default
textplot_bitermclusters(
x,
biterms,
which,
labels = seq_len(length(table(biterms$topic))),
title = "Biterm topic model",
subtitle = list(),
...
)
an object of class ggplot
a list of data.frames, each containing the columns token and probability corresponding to how good a token is emitted by a topic. The list index is assumed to be the topic number
not used
a data.frame with columns term1, term2, topic with all biterms and the topic these were assigned to
integer vector indicating to display only these topics. See the examples.
a character vector of names. Should be of the same length as the number of topics in the data.
character string with the title to use in the plot
character string with the subtitle to use in the plot
# \dontshow{
if(require(igraph) && require(BTM) && require(ggraph) &&
require(ggforce) && require(concaveman) && require(ggplot2) &&
require(data.table) && require(udpipe))
{
# }
library(igraph)
library(ggraph)
library(concaveman)
library(ggplot2)
library(BTM)
data(example_btm, package = 'textplot')
group_terms <- terms(example_btm, top_n = 3)
group_biterms <- example_btm$biterms$biterms
# \donttest{
textplot_bitermclusters(x = group_terms, biterms = group_biterms)
textplot_bitermclusters(x = group_terms, biterms = group_biterms,
title = "BTM model", subtitle = "Topics 7-15",
which = 7:15, labels = seq_len(example_btm$K))
group_terms <- terms(example_btm, top_n = 10)
textplot_bitermclusters(x = group_terms, biterms = group_biterms,
title = "BTM model", subtitle = "Topics 1-5",
which = 1:5, labels = seq_len(example_btm$K))
# }
group_terms <- terms(example_btm, top_n = 7)
topiclabels <- c("Garbage",
"Data Mining", "Gradient descent", "API's",
"Random Forests", "Stat models", "Text Mining / NLP",
"GLM / GAM / Bayesian", "Machine learning", "Variable selection",
"Regularisation techniques", "Optimisation", "Fuzzy logic",
"Classification/Regression trees", "Text frequencies",
"Neural / Deep learning", "Variable selection",
"Text file handling", "Text matching", "Topic modelling")
textplot_bitermclusters(x = group_terms, biterms = group_biterms,
title = "Biterm topic model", subtitle = "some topics",
which = c(3, 4, 5, 6, 7, 9, 12, 16, 20),
labels = topiclabels)
# \dontshow{
}
# End of main if statement running only if the required packages are installed
# }
Run the code above in your browser using DataLab