which.max(sapply,train_gibbs,logLik)错误

时间:2015-05-11 12:01:12

标签: r cross-validation topic-modeling topicmodels

因此,我通过计算10倍训练和测试集的困惑来遵循Grun和Hornik(http://www.jstatsoft.org/v40/i13/)方法进行10倍交叉验证。但是当我创建test_gibbs时出现错误,这表示下面代码的结尾。任何人都可以建议如何解决这个问题?提前致谢。

R> dim(dtm)
[1]  546 1484
R> fold <- 1
R> range(col_sums(dtm))
[1]   1 192
R> set.seed(0908)
R> folding <-
+  sample(rep(seq_len(10),
+  ceiling(nrow(dtm)))[seq_len(nrow(dtm))])
R> testing <- which(folding == fold)
R> training <- which(folding != fold)
R> topics <- 10 * c(1:5, 10, 20)
R> train <- LDA(dtm[training,], k = k,
+  control = list(verbose = 100))
final e step document 491
R> test <- LDA(dtm[testing,], model = train,
+  control = list(estimate.beta = FALSE))
R> train_gibbs <- LDA(dtm[training,], k = k, method = "Gibbs",
+  control = list(burnin = 1000, thin = 100,
+  iter = 1000, best = FALSE))
R> # this is where the error occurs################
R> test_gibbs <- LDA(dtm[testing,],
+  model = train_gibbs[[which.max(sapply, train_gibbs, logLik)]],
+  control = list(estimate.beta = FALSE, burnin = 1000,
+  thin = 100, iter = 1000, best = FALSE))

.max(sapply,train_gibbs,logLik)中的错误:未使用的参数(train_gibbs,logLik)

0 个答案:

没有答案