Как проверить все результаты, когда я установил best = FALSE и / или save = 100, используя пакет topicmodels в R? - PullRequest
0 голосов
/ 28 октября 2019

Я изучаю тематическое моделирование с использованием topicmodels, tm и соответствующих пакетов в R. Допустим, у меня есть данные и простой код:

library(tm)
library(topicmodels)
docs <- tibble(doc_id=1:10,
               text=c('In natural language processing, latent Dirichlet    allocation (LDA) is a generative statistical model that allows sets of observations to be explained by',
                  'it posits that each document is a mixture of a small number of topics and that each word presence is attributable to one of the documents topics',
                  'In LDA, each document may be viewed as a mixture of various topics where each document is considered to',
                  'The sparse Dirichlet priors encode the intuition that documents cover only a small set of topics and that topics',
                  'For example, an LDA model might have topics that can be classified as',
                  'Each document is assumed to be characterized by a particular set of topics',
                  'This is similar to the standard bag of words model assumption, and makes the individual words exchangeable',
                  'the dependencies among the many variables can be captured concisely',
                  'Following is the derivation of the equations for collapsed Gibbs sampling',
                  'Topic modeling is a classic problem in information retrieval'))
ds <- DataframeSource(docs)
x <- Corpus(ds)
dtm <- DocumentTermMatrix(x)
ap_lda <- LDA(dtm, k = 5,method = 'Gibbs', 
               control = list(seed = 1234))
ap_lda1 <- LDA(dtm, k = 5,method = 'Gibbs', 
              control = list(seed = 1234,best=FALSE,save=100))

Пока что я просто сосредотачиваюсь на LDA и Gibbs. Но есть некоторые объяснения и использование параметров, которые я запутался. В приведенном выше коде ap_lda является формальным результатом. И ap_lda1 - это результат с best = FALSE и save = 100. Итак, следует вернуть все результаты. Я вижу, что в пути, указанном префиксом, есть несколько файлов с помощью save = 100:

enter image description here

Но как их изучить и использовать?

Кроме того, когда я использую best = FALSE, кажется, что формат хранения ap_lda и ap_lda1 изменился:

enter image description here

Но какиспользовать все результаты в ap_lda1, который должен включать все результаты?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...