本文整理汇总了Python中memory.Memory.test方法的典型用法代码示例。如果您正苦于以下问题:Python Memory.test方法的具体用法?Python Memory.test怎么用?Python Memory.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类memory.Memory
的用法示例。
在下文中一共展示了Memory.test方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import test [as 别名]
def test(test_iter, folds, training_folds):
results = []
mem = Memory()
for i in range(test_iter):
print "iteration %d ..." % (i + 1)
ini_set = split_set2(folds, senseval.instances()[0:])
for j in range(folds):
print"...fold %d ..." % (j + 1)
sets = partition_set(training_folds, ini_set, j)
print "-$$Train time$$-"
mem.train(sets[0])
print "-$$results time$$-"
results.append(mem.test(sets[1]))
return results
示例2: test_main
# 需要导入模块: from memory import Memory [as 别名]
# 或者: from memory.Memory import test [as 别名]
def test_main():
mem = Memory()
print "loading data_set"
ini_set = split_set2(5, senseval.instances()[0:10000])
data_set = partition_set(4, ini_set, 0)
#Serializer.save("/tmp/portioned_data", data_set)
#data_set = Serializer.load("/tmp/portioned_data")
print "training data"
mem.train(data_set[0])
#print "saving data"
#mem.save_values("/tmp/mem_internals")
#mem.load_values("/tmp/mem_internals")
print "------*********testing**********------"
results = mem.test(data_set[1])
print "%3.1f %% accuracy" %(sum(results)/len(results) * 100)