本文整理汇总了Python中hmm.HMM.baum_welch_train方法的典型用法代码示例。如果您正苦于以下问题:Python HMM.baum_welch_train方法的具体用法?Python HMM.baum_welch_train怎么用?Python HMM.baum_welch_train使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hmm.HMM
的用法示例。
在下文中一共展示了HMM.baum_welch_train方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enumerate
# 需要导入模块: from hmm import HMM [as 别名]
# 或者: from hmm.HMM import baum_welch_train [as 别名]
for i, elem in enumerate(zip(hypotheses, references)): #debug
print ''.join(test_set[i].old_data), elem #debug
#debug
print compute_PER(references, hypotheses)
hmm.print_parameters()
"""
#unsupervised training
#for mode in ['uniform', 'random', 'sneaky']:
for mode in ['sneaky']:
hmm = HMM()
hmm._be_prepared_for_baum_welch(training_set, 'sneaky')
hmm.baum_welch_train(training_set)
#Experiment x.2
hypotheses2 = [hmm.classify_instance(x) for x in training_set]
references2 = [x.old_label for x in training_set]
print "Over Training Set:"
print compute_PER(references2, hypotheses2)
#Experiment x.3
hypotheses = [hmm.classify_instance(x) for x in test_set]
references = [x.label for x in test_set]
print "Over Test Set:"
print compute_PER(references, hypotheses)