我最近一直在研究一种用于确定乳腺癌肿瘤恶性程度的分类器。但是,在代码末尾,我总是收到追溯错误。
def main():
# TODO
print ("Reading in training data...")
trainingSet = []
trainingFile = "cancerTrainingData.txt"
trainingSet = makeTrainingSet(trainingFile)
print ("Done reading training data.\n")
print ("Training classifier...")
trainedClassifier = trainClassifier(trainingSet)
print ("Done training classifier.\n")
print ("Present Classifier Stats")
dumpStats(trainedClassifier[0], trainedClassifier[1], trainedClassifier[2])
print ("Reading in test data...")
testFile = "cancerTestingData.txt"
testSet = makeTestSet(testFile)
print ("Done reading test data.\n")
print ("Classifying records...")
classifiedTestSet = classifyTestRecords(testSet, trainedClassifier[0])
print ("Done classifying.\n")
reportAccuracy(classifiedTestSet)
print ("Check some Patients")
checkSomePatients(classifiedTestSet, trainedClassifier[0])
print ("Program finished.\n")
main()
代码返回以下错误:
TypeError Traceback (most recent call last)
<ipython-input-10-db4d57bf1cdf> in <module>()
356 print ("Program finished.\n")
357
--> 358 main()
如果有人能指出解决方法,我将不胜感激。谢谢!