#数据处理并计算错误率
def classifer():
la,testd=duqushuju('datingTestSet2.txt')
da,qujian,zuixiaode=guiyi(testd)
error=1
m=0.1
s=da.shape[0]
ceshishu=int(s*m)
for i in range(ceshishu):
leibiejieguo=classify1(da[i,:],da[ceshishu:s,:],la[ceshishu:s],6)
if leibiejieguo==la[i]:
error +=1
print('cuowubil= %f'%(error/float(ceshishu)))
#classifer()
#对人进行分类
def clasperson():
result=['bu','littlt','feichang']
ptat=float(input('game'))
mile=float(input('year'))
ice=float(input('ice'))
la,testd=duqushuju('datingTestSet2.txt')
da,qujian,zuixiaode=guiyi(testd)
inarr=array([mile,ptat,ice])
claresu=classify1((inarr-zuixiaode)/qujian,da,la,3)
print('person:'+str(result[int(claresu)-1]))
clasperson()