0
我工作的topicmodels R package,並試圖瞭解一個使用LDA
功能和LDA對象下面的例子:R,在topicmodels包中,如何訪問類LDA的對象?
data("AssociatedPress", package = "topicmodels")
control = list(alpha = 0.1)
lda <- LDA(AssociatedPress[1:20,], k = 2, method=」VEM」, control)
lda_inf <- posterior(lda, AssociatedPress[21:30,])
我想了解什麼是LDA實例內。 從包instruction document,我讀到有下列對象:
call: Object of class "call".
Dim: Object of class "integer"; number of documents and terms.
control: Object of class "TopicModelcontrol"; options used for estimating the topic model.
k: Object of class "integer"; number of topics.
terms: Vector containing the term names.
....
的問題是,我不能夠訪問它們。 lda$call
不起作用。
我該怎麼辦? 我如何閱讀他們的內容?
不知道這個包,但似乎'LDA'返回一個'S4'對象,因此你可以通過'@'操作符訪問它的插槽。嘗試'lda @ call'而不是'lda $ call'。 – nicola 2014-09-24 20:48:42
@Nicola它的作品,謝謝! :-)如果你把它寫成答案,我會接受它 – 2014-09-24 22:01:18