predict: predict for 'tmTopicModel' object

Description Usage Arguments References

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'tmTopicModel'
predict(object, x, stoplist_file = "en.txt",
  token_regexp = regexp_token, n_iterations = 100, sampling_interval = 10,
  burn_in = 10, random_seed = NULL, ...)

## S3 method for class 'LDA'
predict(object, x, ...)

## S3 method for class 'jobjRef'
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


textmining documentation built on May 2, 2019, 6:47 a.m.