fit.sentopicmodel | R Documentation |
This function is used to estimate a topic model created by
LDA()
, JST()
or rJST()
. In essence, this function iterates a Gibbs
sampler MCMC.
## S3 method for class 'sentopicmodel'
fit(
object,
iterations = 100,
nChains = 1,
displayProgress = TRUE,
computeLikelihood = TRUE,
seed = NULL,
...
)
## S3 method for class 'multiChains'
fit(
object,
iterations = 100,
nChains = NULL,
displayProgress = TRUE,
computeLikelihood = TRUE,
seed = NULL,
...
)
object |
a model created with the |
iterations |
the number of iterations by which the model should be fitted. |
nChains |
if set above 1, the model will be fitted multiple times
from various starting positions. Latent variables will be re-initialized if
|
displayProgress |
if |
computeLikelihood |
if set to |
seed |
for reproducibility, a seed can be provided. |
... |
arguments passed to other methods. Not used. |
a sentopicmodel
of the relevant model class if nChains
is
unspecified or equal to 1. A multiChains
object if nChains
is greater
than 1.
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.
LDA()
, JST()
, rJST()
, reset()
model <- rJST(ECB_press_conferences_tokens)
fit(model, 10)
# -- Parallel computation --
require(future.apply)
future::plan("multisession", workers = 2) # Set up 2 workers
fit(model, 10, nChains = 2)
future::plan("sequential") # Shut down workers
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.