import logRegres
logRegres.multiTest(3)#the error rate of this test is: 0.128770#the error rate of this test is: 0.201532#the error rate of this test is: 0.113930#the error rate of this test is: 0.018669#the error rate of this test is: 0.166108#the error rate of this test is: 0.127334#the error rate of this test is: 0.127812#the error rate of this test is: 0.034466#the error rate of this test is: 0.136908#the error rate of this test is: 0.020584#after 10 iterations the average error rate is: 0.107611
2.分类预测
# 输入数据
frTrain =open('horseColicTraining.txt');
trainingSet =[]; trainingLabels =[]for line in frTrain.readlines():
currLine = line.strip().split('\t')
lineArr =[]for i inrange(3):
lineArr.append(float(currLine[i]))
trainingSet.append(lineArr)
trainingLabels.append(float(currLine[3]))
1. 成绩通过情况的分类错误率import logRegreslogRegres.multiTest(3)#the error rate of this test is: 0.128770#the error rate of this test is: 0.201532#the error rate of this test is: 0.113930#the error rate of this test is: 0.018669#the error rate of this test is: