-1

My problem is that I want to plot the log.likelihoods gathered from LDA execution in R using the LDA package. My code is:

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) 
Brian
  • 14,610
  • 7
  • 35
  • 43

1 Answers1

0

I found the solution:

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))