def eval_pp(net, z, zt):
    """
    Evaluate the perplexity of net
    z: training dictionary
    zt: testing dictionary
    """
    if net.name != 'lbl':
        Im = zt['IM']
    else:
        Im = None
    pp = lm_tools.perplexity(net, zt['ngrams'], z['word_dict'], Im=Im, context=net.context)
    print 'PERPLEXITY: ' + str(pp)
def eval_pp(net, z, zt):
    """
    Evaluate the perplexity of net
    z: training dictionary
    zt: testing dictionary
    """
    if net.name != 'lbl':
        Im = zt['IM']
    else:
        Im = None
    pp = lm_tools.perplexity(net,
                             zt['ngrams'],
                             z['word_dict'],
                             Im=Im,
                             context=net.context)
    print 'PERPLEXITY: ' + str(pp)
示例#3
0
 def compute_pp(self, Xp, word_dict):
     """
     Compute the model perplexity
     """
     return lm_tools.perplexity(self, Xp, word_dict, context=self.context)
示例#4
0
 def compute_pp(self, Xp, word_dict):
     """
     Compute the model perplexity
     """
     return lm_tools.perplexity(self, Xp, word_dict, context=self.context)