当前位置: 首页>>代码示例>>Python>>正文


Python HMM.feature_codebook方法代码示例

本文整理汇总了Python中hmm.HMM.feature_codebook方法的典型用法代码示例。如果您正苦于以下问题:Python HMM.feature_codebook方法的具体用法?Python HMM.feature_codebook怎么用?Python HMM.feature_codebook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hmm.HMM的用法示例。


在下文中一共展示了HMM.feature_codebook方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_hmm_all

# 需要导入模块: from hmm import HMM [as 别名]
# 或者: from hmm.HMM import feature_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)
开发者ID:sdiao,项目名称:CS134,代码行数:26,代码来源:evaluator.py


注:本文中的hmm.HMM.feature_codebook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。