我正在使用topicmodels
R 中的包进行主题建模。我正在创建一个语料库对象,进行一些基本的预处理,然后创建一个 DocumentTermMatrix:
library(topicmodels)
#Set parameters for Gibbs sampling
burnin <- 4000
iter <- 2000
thin <- 500
seed <-list(2003,5,63,100001,765)
nstart <- 5
best <- TRUE
#Number of topics
k <- 8
#Run LDA using Gibbs sampling
# Start the clock!
ptm <- proc.time()
ldaOut <-LDA(dtm.new,k, method="Gibbs", control=list(nstart=nstart, seed = seed, best=best,
burnin = burnin, iter = iter, thin=thin))
# Stop the clock
proc.time() - ptm
然后我在最后一行得到了错误
#docs to topics
ldaOut.topics <- as.matrix(topics(ldaOut))
这是错误:
error in 1:nrow(counts) : argument of length 0
我认为这意味着它不能计算第一行。有什么方法可以检查。