R/topic_modeling_core.R
posterior.lda_topic_model.Rd
This function takes an object of class lda_topic_model
and
draws samples from the posterior of either phi
or theta
. This is
useful for quantifying uncertainty around parametersof the final model.
# S3 method for lda_topic_model
posterior(object, which = "theta", num_samples = 100, ...)
An object of class lda_topic_model
A character of either 'theta' or 'phi', indicating from which matrix to draw posterior samples
Integer number of samples to draw
Other arguments to be passed to TmParallelApply
.
Returns a data frame where each row is a single sample from the posterior.
Each column is the distribution over a single parameter. The variable var
is a facet for subsetting by document (for theta) or topic (for phi).
Heinrich, G. (2005) Parameter estimation for text analysis. Technical report. http://www.arbylon.net/publications/text-est.pdf