本文整理汇总了Python中hmm.HMM.label_codebook方法的典型用法代码示例。如果您正苦于以下问题:Python HMM.label_codebook方法的具体用法?Python HMM.label_codebook怎么用?Python HMM.label_codebook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hmm.HMM
的用法示例。
在下文中一共展示了HMM.label_codebook方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hmm_all
# 需要导入模块: from hmm import HMM [as 别名]
# 或者: from hmm.HMM import label_codebook [as 别名]
def test_hmm_all():
"""
This method tests the entire workflow:
PreProcessor:
populate the label codebook, feature codebook, and instance list from the dataset
"""
# Please specify the dataset path here
train_set_path = "C:\\Users\\DIAOSHUO\\Dropbox\\SNLP\\cs134assn2\\np_chunking_wsj_15_18_train"
test_set_path = "C:\\Users\\DIAOSHUO\\Dropbox\\SNLP\\cs134assn2\\np_chunking_wsj_20_test"
# Preprocess
pp = PreProcessor()#use
hmm = HMM()
hmm.label_codebook= pp.get_label_codebook()
hmm.feature_codebook = pp.get_feature_codebook()
#train_set = pp.make_instance_list() # default, the dataset path is the training set, np_chunking_wsj_15_18_train
#test_set = pp.make_instance_list(test_set_path)
train_instance_list = pp.get_instance_list(train_set_path)
test_instance_list = pp.get_instance_list(test_set_path)
#running 3 kinds of test
split_train_test(hmm, train_instance_list, [0.8,0.2])
n_fold_cross_validation(hmm,train_instance_list)
simple_train_test(hmm,train_instance_list, test_instance_list)