我的问题是我想使用LDA包在R中绘制从LDA执行中收集的log.likelihoods
。我的代码是:
K <- 10 ## Num clusters
result <- lda.collapsed.gibbs.sampler(cora.documents,
K, ## Num clusters
cora.vocab,
25, ## Num iterations
0.1,
0.1,
compute.log.likelihood=TRUE)
答案 0 :(得分:0)
我找到了解决方案:
df<-data.frame(topics=c(1:100), LL=as.numeric(as.matrix(result$log.likelihood[1,])))
ggplot(df, aes(x=topics, y=LL)) +
xlab("iteration") + ylab("Log likelihood of the model") +
geom_line() +
theme_bw() +
theme(axis.title.x = element_text(vjust = -0.25, size = 14)) +
theme(axis.title.y = element_text(size = 14, angle=90))