我正在使用“topicmodels”包在 R 中构建一些主题模型。在预处理和创建文档术语矩阵之后,我正在应用以下 LDA Gibbs 模型。这可能是一个简单的答案,但我是 R 的新手,所以就这样吧。有没有办法可以将主题和术语列表及其概率导出到文本文件或 Excel 文件?我可以在 R 中打印它们(如下所示),但不知道如何导出 :(
这主要是因为我可以做一些可视化,我确信可以在 Excel 中完成,但就像我提到的那样,我是一个新手,没有太多可用于学习 R 中的可视化技术。希望这是有道理的
k = 33
burnin = 1000
iter = 1000
keep = 50
seed = 2003
model_lda <- LDA(myDtm, k = k, method = "Gibbs",control = list(seed = seed, burnin = burnin, iter = iter, keep = keep))
print(model_lda)
save(model_lda, file = "LDA_Output.RData")
topics(model_lda, 5)
terms(model_lda, 15)
Topic 1 Topic 2 Topic 3 Topic 4 Topic 5 Topic 6 Topic 7
[1,] "seat" "dialogu" "websit" "census" "northern" "growth" "hse"
[2,] "resum" "church" "partnership" "disabl" "univers" "adjust" "legisl"
[3,] "suspend" "congreg" "nesc" "cso" "peac" "forecast" "die"
[4,] "adjourn" "school" "site" "statist" "unemploy" "bernard" "legal"
[5,] "fisheri" "survivor" "nesf" "survey" "polic" "burton" "child"