def log_perplexity(self, chunk, total_docs=None):
        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, subsample_ratio=subsample_ratio) / (subsample_ratio * corpus_words)
        logger.info("%.3f per-word bound, %.1f perplexity estimate based on a held-out corpus of %i documents with %i words" %
            (perwordbound, numpy.exp2(-perwordbound), len(chunk), corpus_words))
        return perwordbound
dataset/ETHPy150Open largelymfs/topical_word_embeddings/TWE-1/gensim/models/ldamodel.py/LdaModel.log_perplexity/original