2014-01-09 20 views
1

我對R完全陌生,我目前正在使用tmlda包來分析日誌。lda.collapsed.gibbs.sampler最初不能在R工作

lda.collapsed.gibbs.sampler可以採取「初始」的參數,並在文檔中它表示:

initial

A list of initial topic assignments for words. It should be in the same format as the assignments field of the return value. If this field is NULL, then the sampler will be initialized with random assignments.

但是當我試圖通過重複先前的結果$分配的參數最初,我得到一個錯誤:我得到一個錯誤:

> result <- lda.collapsed.gibbs.sampler(data, K,vocab,i, 0.1,0.1, initial = lda_result$assignments, compute.log.likelihood=TRUE) 
Error in structure(.Call("collapsedGibbsSampler", documents, as.integer(K), : 
STRING_ELT() can only be applied to a 'character vector', not a 'NULL' 

我不知道如何擺脫,實際使用列表。我想要的是通過採取步驟並觀察結果來獲得收斂性,因此只需將i作爲更大的數字就行不通。

在此先感謝! :)

回答

1

這裏的文檔有點多。您需要設置initial=list(assignments = lda_result$assignments)。更一般地,initial是必須具有assignments組或者topicstopic_sums組的列表。

+0

謝謝!現在它工作:)文檔是絕對不清楚的。 –