本文整理汇总了Python中parameters.Parameters.appendResults方法的典型用法代码示例。如果您正苦于以下问题:Python Parameters.appendResults方法的具体用法?Python Parameters.appendResults怎么用?Python Parameters.appendResults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parameters.Parameters
的用法示例。
在下文中一共展示了Parameters.appendResults方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: KNNClassifier
# 需要导入模块: from parameters import Parameters [as 别名]
# 或者: from parameters.Parameters import appendResults [as 别名]
# Instantiate the classifier
clf = KNNClassifier()
# Train the spatial pooler on trainingVectors.
numCycles = tb.train(trainingVectors, trainingTags, clf, maxTrainingCycles,
minAccuracy)
# Save the permanences and connections after training.
#tb.savePermanences('perms.jpg')
#tb.showPermanences()
#tb.showConnections()
# Get testing images and convert them to vectors.
testingImages, testingTags = data.getImagesAndTags(testingDataset)
testingVectors = encoder.imagesToVectors(testingImages)
# Reverse the order of the vectors and tags for testing
testingTags = [testingTag for testingTag in reversed(testingTags)]
testingVectors = [testingVector for testingVector in reversed(testingVectors)]
# Test the spatial pooler on testingVectors.
accuracy = tb.test(testingVectors, testingTags, clf)
# Add results to the list
parameters.appendResults([accuracy, numCycles])
parameters.printResults(["Percent Accuracy", "Training Cycles"], [", %.2f", ", %d"])
print "The maximum number of training cycles is set to:", maxTrainingCycles