python内tile、shape、get函数的用法
get函数在字典内的用法,当字典内不存在a时,使用classCount.get(votelabel,0)在字典内添加了‘a’,在字典内存在‘a’之后,使用
classCount[votelabel]=classCount.get(votelabel,0)+1使得‘a’的数目增加
#tile的作用
#>>> numpy.tile([0,0],(2,1))#在列方向上重复[0,0]1次,行2次
#array([[0, 0],
# [0, 0]])
shape函数的作用
dataSetSize= dataSet.shape[0]%使用shape[0] #读取矩阵第一维度(列)的长度