1 #约会网站预测数据 2 def classifyPersion(): 3 resultList = ['not at all','in small doses','in large doses'] 4 #input()函数允许用户输入文本行命令并返回用户所输入的命令 5 percentTats = float(input("percentage of time spent playing video games?")) 6 ffMiles = float(input("frequent year?")) 7 iceCream = float(input("liters years?")) 8 datingDataMat,datingLabels = file2matrix('datingTestSet2.txt') 9 normMat, ranges, minVals = autoNorm(datingDataMat) 10 inArr = array([ffMiles,percentTats, iceCream]) 11 classifierResult = classify0((inArr-minVals)/ranges,normMat,datingLabels,3) 12 print("you like person:",resultList[classifierResult - 1])