摘要:
1 #通过统计classList(标签列)中每种值的个数,得到次数最多的标签 2 def majorityCnt(classList): 3 classCount = {} 4 for vote in classList: 5 if vote not in classCount.keys(): 6 阅读全文
摘要:
序号 描述 代码 备注 1、 获得数据集某特征列/标签列 特征列: 1 for i in range(numFeatures): 2 featList = [example[i] for example in dataSet] 标签列: 1 classList = [example[-1] for 阅读全文
摘要:
1 def classifyPerson(): 2 resultList = ['not at all.','in small doses.','in large doses.'] 3 percentTats = float(input('pencentage of time spent playi 阅读全文