':key: è®¡ç®PerplexityåŒ,å¹¶è¿å'

def calculate_perplexity(self):

    self.calculate_theta()
    self.calculate_phi()
    preplexity = 0.0
    for m in range(self.M):
        for w in self.arts_Z[m]:
            preplexity += numpy.log(numpy.sum((self.theta[m] * self.phi[:, w])))
    return numpy.exp((- (preplexity / self.words_count)))
