全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
2397 7
2015-08-28
result <- slda.em(documents=corpus$documents,
                  K=num.topics,
                  vocab=corpus$vocab,
                  num.e.iterations=30,
                  num.m.iterations=12,
                  alpha=1.0, eta=0.1,
                  poliblog.ratings / 100,
                  params,
                  variance=0.25,
                  lambda=1.0,
                  logistic=FALSE,
                  method="sLDA")
这个是代码,出现:Error in slda.em(documents = corpus$documents, K = num.topics, vocab = corpus$vocab,  :
  All documents must have positive length.
求大神教下如何解决

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-8-29 03:05:15
这个没用过,看了下注释:
documents       
A list whose length is equal to the number of documents, D. Each element of documents is an integer matrix with two rows. Each column of documents[[i]] (i.e., document i) represents a word occurring in the document.
documents[[i]][1, j] is a 0-indexed word identifier for the jth word in document i. That is, this should be an index - 1 into vocab. documents[[i]][2, j] is an integer specifying the number of times that word appears in the document.

vocab       
A character vector specifying the vocabulary words associated with the word indices used in documents.

感觉是不是documents错了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-8-29 08:41:45
asdasdaseee 发表于 2015-8-29 03:05
这个没用过,看了下注释:
documents       
A list whose length is equal to the number of documents, D. Ea ...
你用的不是lda建立模型吗
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-4-22 01:29:19
请问一下,这个问题有解决吗,我也遇到同样的问题
> result <- slda.em(documents=corpus$documents,
+                   K=num.topics,
+                   vocab=corpus$vocab,
+                   num.e.iterations=30,
+                   num.m.iterations=12,
+                   alpha=1.0, eta=0.1,
+                   poliblog.ratings / 100,
+                   params,
+                   variance=0.25,
+                   lambda=1.0,
+                   logistic=FALSE,
+                   method="sLDA")
Error in slda.em(documents = corpus$documents, K = num.topics, vocab = corpus$vocab,  :
  All documents must have positive length.
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-9-6 11:25:25
corpus$documents和 poliblog.ratings 的length要一样
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2016-12-8 19:58:30
更静一点 发表于 2016-4-22 01:29
请问一下,这个问题有解决吗,我也遇到同样的问题
> result
您好,我也遇到了相关问题,不知您是否解决了,可以借鉴一下吗?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群