Learn R Programming

textmining (version 0.0.1)

predict: predict for tmTopicModel object

Description

#' Function to predict topic model probabilities for existing topic model #' #' @param topic.model tmTopicModel obiect #' @param x tmCorpus object #' @param stoplist_file directory of file with stopwords #' @param token_regexp regular expression patterns #' @param burn_in parameter of mallet model #' @param sampling_interval parameter of mallet model #' @param n_iterations parameter of mallet model #' @param random_seed parameter of mallet model #' @param change predict structure so it fits normal #' #' @return returns the table of topic probabilities #' #' @export predict <- function(topic.model, x, stoplist_file = "en.txt", token_regexp = regexp_token, n_iterations = 100, sampling_interval = 10, burn_in = 10, random_seed = NULL) UseMethod("predict")

Function to predict topic model probabilities for an existing topic model. The code snippets for Mallet interface were derived from Andrew Goldstone's solution, posted at https://gist.github.com/agoldst/edcfd45b5ac371296b76

Usage

"predict"(object, x, stoplist_file = "en.txt", token_regexp = regexp_token, n_iterations = 100, sampling_interval = 10, burn_in = 10, random_seed = NULL, ...)
"predict"(object, x, ...)
"predict"(object, x, stoplist_file = "en.txt", token_regexp = regexp_token, n_iterations = 100, sampling_interval = 10, burn_in = 10, random_seed = NULL, ...)

Arguments

object
A tmTopicModel or LDA or jobjRef object
x
new data to predict probabilities of topics
stoplist_file
file direcroty or vector of stopwords
token_regexp
regular expression token
n_iterations
mallet LDA topic model parameter
sampling_interval
mallet LDA topic model parameter
burn_in
mallet LDA topic model parameter
random_seed
random seed
...
other motdel arguments

References

https://gist.github.com/agoldst/edcfd45b5ac371296b76