perplexity(object, newdata, …)# S4 method for VEM,simple_triplet_matrix
perplexity(object, newdata, control, …)
# S4 method for Gibbs,simple_triplet_matrix
perplexity(object, newdata, control, use_theta = TRUE,
estimate_theta = TRUE, …)
# S4 method for Gibbs_list,simple_triplet_matrix
perplexity(object, newdata, control, use_theta = TRUE,
estimate_theta = TRUE, …)
"TopicModel"
or "Gibbs_list"
.newdata
needs to be specified.control
of the fitted model is
used with suitable changes of the relevant parameters (see
Details)."logical"
. If TRUE
the estimated topic distributions for the documents are
used. Otherwise equal weights are assigned to the topics for each document."logical"
. If FALSE
the
data provided is assumed to be the same as the data used for fitting the
model. The topic distributions therefore do not need to be estimated
and the data in newdata
is used for weighting the
term-document occurrences.estimate.beta=FALSE
and (2) nstart=1
. For "Gibbs_list"
objects the control
is further modified
to have (1) iter=thin
and (2) best=TRUE
and the model is
fitted to the new data with this control for each available
iteration. The perplexity is then determined by averaging over the
same number of iterations. If a list
is supplied as object
, it is assumed that it
consists of several models which were fitted using different starting
configurations.