class_docstr: The constructor estimates the author-topic model parameters based on a training corpus.
class_docstr_tok: ["The","constructor","estimates","the","author-topic","model","parameters","based","on","a","training","corpus","."]
docstr: Calculate per-word likelihood bound, using the `chunk` of documents as evaluation corpus.
  
  Parameters
  ----------
  chunk : iterable of list of (int, float)
      Corpus in BoW format.
  chunk_doc_idx : numpy.ndarray, optional
      Assigns the value for document index.
  total_docs : int, optional
      Initializes the value for total number of documents.
  
  Returns
  -------
  float
      Value of per-word likelihood bound.
docstr_tok: ["Calculate","per-word","likelihood","bound",",","using","the","`","chunk","`","of","documents","as","evaluation","corpus",".","Parameters","--","--","--","--","--","chunk",":","iterable","of","list","of","(","int",",","float",")","Corpus","in","BoW","format",".","chunk_doc_idx",":","numpy.ndarray",",","optional","Assigns","the","value","for","document","index",".","total_docs",":","int",",","optional","Initializes","the","value","for","total","number","of","documents",".","Returns","--","--","--","-","float","Value","of","per-word","likelihood","bound","."]
code: def log_perplexity(self, chunk, chunk_doc_idx=None, total_docs=None):
      """Calculate per-word likelihood bound, using the `chunk` of documents as evaluation corpus.
  
      Parameters
      ----------
      chunk : iterable of list of (int, float)
          Corpus in BoW format.
      chunk_doc_idx : numpy.ndarray, optional
          Assigns the value for document index.
      total_docs : int, optional
          Initializes the value for total number of documents.
  
      Returns
      -------
      float
          Value of per-word likelihood bound.
  
      """
      # TODO: This method is very similar to the one in LdaModel. Refactor.
      if total_docs is None:
          total_docs = len(chunk)
      corpus_words = sum(
          cnt for document in chunk for _, cnt in document
      )
      subsample_ratio = 1.0 * total_docs / len(chunk)
      perwordbound = self.bound(
          chunk, chunk_doc_idx, subsample_ratio=subsample_ratio
      ) / (subsample_ratio * corpus_words)
      logger.info(
          "%.3f per-word bound, %.1f perplexity estimate based on a corpus of %i documents with %i words",
          perwordbound,
          np.exp2(-perwordbound),
          len(chunk),
          corpus_words,
      )
      return perwordbound
  
imports: import logging
  from itertools import chain
  from copy import deepcopy
  from shutil import copyfile
  from os.path import isfile
  from os import remove
  import numpy
  from scipy.special import gammaln
  from gensim import utils
  from gensim.models import LdaModel
  from gensim.models.ldamodel import LdaState
  from gensim.matutils import dirichlet_expectation, mean_absolute_difference
  from gensim.corpora import MmCorpus
label_desc: Use image node_id 8 for calling the AuthorTopicModel obj's underlying member method code with example usage: obj.log_perplexity(chunk, chunk_doc_idx, total_docs) and returns: perwordbound