ldavowpalwabbit.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:nonce2vec 作者: minimalparts 项目源码 文件源码
def log_perplexity(self, chunk):
        """Return per-word lower bound on log perplexity.

        Also logs this and perplexity at INFO level.
        """
        vw_data = self._predict(chunk)[1]
        corpus_words = sum(cnt for document in chunk for _, cnt in document)
        bound = -vw_data['average_loss']
        LOG.info("%.3f per-word bound, %.1f perplexity estimate based on a "
                 "held-out corpus of %i documents with %i words",
                 bound,
                 numpy.exp2(-bound),
                 vw_data['corpus_size'],
                 corpus_words)
        return bound
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号