def analysis(classifier, guesses, testLabels, testData, rawTestData, printImage):
"""
This function is called after learning.
Include any code that you want here to help you analyze your results.
Use the printImage(<list of pixels>) function to visualize features.
An example of use has been given to you.
- classifier is the trained classifier
- guesses is the list of labels predicted by your classifier on the test set
- testLabels is the list of true labels
- testData is the list of training datapoints (as util.Counter of features)
- rawTestData is the list of training datapoints (as samples.Datum)
- printImage is a method to visualize the features
(see its use in the odds ratio part in runClassifier method)
This code won't be evaluated. It is for your own optional use
(and you can modify the signature if you want).
"""
# Put any code here...
# Example of use:
# for i in range(len(guesses)):
# prediction = guesses[i]
# truth = testLabels[i]
# if (prediction != truth):
# print "==================================="
# print "Mistake on example %d" % i
# print "Predicted %d; truth is %d" % (prediction, truth)
# print "Image: "
# print rawTestData[i]
# break
## =====================
## You don't have to modify any code below.
## =====================
dataClassifier.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录