chainsScores {sentopics} | R Documentation |
Compute scores of topic models (chains)
Description
Compute various scores (log likelihood, coherence) for a list of topic models.
Usage
chainsScores(x, window = 110, nWords = 10)
Arguments
x |
a valid |
window |
optional. If |
nWords |
the number of words used to compute coherence. See
|
Value
A data.table
with some statistics about each chain. For the
coherence metrics, the value shown is the mean coherence across all topics
of a chain
Parallelism
When nChains > 1
, the function can take advantage of
future.apply::future_lapply (if installed) to spread the computation over
multiple processes. This requires the specification of a parallel strategy
using future::plan()
. See the examples below.
See Also
Examples
model <- LDA(ECB_press_conferences_tokens[1:10])
model <- fit(model, 10, nChains = 5)
chainsScores(model, window = 5)
chainsScores(model, window = "boolean")
# -- Parallel computation --
require(future.apply)
future::plan("multisession", workers = 2) # Set up 2 workers
chainsScores(model, window = "boolean")
future::plan("sequential") # Shut down workers