class_docstr: Posterior values associated with each set of documents.
  
  TODO: use **Hoffman, Blei, Bach: Online Learning for Latent Dirichlet Allocation, NIPS 2010.**
  to update phi, gamma. End game would be to somehow replace LdaPost entirely with LdaModel.
class_docstr_tok: ["Posterior","values","associated","with","each","set","of","documents",".","TODO",":","use","*","*","Hoffman",",","Blei",",","Bach",":","Online","Learning","for","Latent","Dirichlet","Allocation",",","NIPS","2010",".","*","*","to","update","phi",",","gamma",".","End","game","would","be","to","somehow","replace","LdaPost","entirely","with","LdaModel","."]
docstr: Compute the log likelihood bound.
  
  Returns
  -------
  float
      The optimal lower bound for the true posterior using the approximate distribution.
docstr_tok: ["Compute","the","log","likelihood","bound",".","Returns","--","--","--","-","float","The","optimal","lower","bound","for","the","true","posterior","using","the","approximate","distribution","."]
code: def compute_lda_lhood(self):
      """Compute the log likelihood bound.
  
      Returns
      -------
      float
          The optimal lower bound for the true posterior using the approximate distribution.
  
      """
      num_topics = self.lda.num_topics
      gamma_sum = np.sum(self.gamma)
  
      # to be used in DIM
      # sigma_l = 0
      # sigma_d = 0
  
      lhood = gammaln(np.sum(self.lda.alpha)) - gammaln(gamma_sum)
      self.lhood[num_topics] = lhood
  
      # influence_term = 0
      digsum = digamma(gamma_sum)
  
      model = "DTM"  # noqa:F841
      for k in range(num_topics):
          # below code only to be used in DIM mode
          # if ldapost.doc_weight is not None and (model == "DIM" or model == "fixed"):
          #     influence_topic = ldapost.doc_weight[k]
          #     influence_term = \
          #           - ((influence_topic * influence_topic + sigma_l * sigma_l) / 2.0 / (sigma_d * sigma_d))
  
          e_log_theta_k = digamma(self.gamma[k]) - digsum
          lhood_term = (
              (self.lda.alpha[k] - self.gamma[k]) * e_log_theta_k
              + gammaln(self.gamma[k])
              - gammaln(self.lda.alpha[k])
          )
          # TODO: check why there's an IF
          n = 0
          for word_id, count in self.doc:
              if self.phi[n][k] > 0:
                  lhood_term += (
                      count
                      * self.phi[n][k]
                      * (
                          e_log_theta_k
                          + self.lda.topics[word_id][k]
                          - self.log_phi[n][k]
                      )
                  )
              n += 1
          self.lhood[k] = lhood_term
          lhood += lhood_term
          # in case of DIM add influence term
          # lhood += influence_term
  
      return lhood
  
imports: import logging
  import numpy
  from scipy.special import digamma, gammaln
  from scipy import optimize
  from gensim import utils, matutils
  from gensim.models import ldamodel
label_desc: Use image node_id 5 for calling the LdaPost obj's underlying member method code with example usage: obj.compute_lda_lhood() and returns: lhood