机器学习实战第二章 k-近邻算法

2.1 KNN算法概述

KNN原理

1 计算需预测的数据与已知数据集中数据之间的距离

2 对距离进行排序

3 取前k个距离,并找到对应的label

4 对前k个距离对应的label进行计数,数最多的即为这个这个需被预测数据的label

2.1.1 导入数据

import numpy as np
import operator
def createDataSet():
    group = np.array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
    labels = ['A','A','B','B']
    return group,labels

2.1.2实施KNN算法

def classify0(inX,dataSet,labels,k):
    dataSetSize = dataSet.shape[0] #此处为行数  ex : (4,2) 4行 2列
    diffMat = np.tile(inX,(dataSetSize,1)) - dataSet #在列方向上重复inX dataSetSize行,1列
    sqDiffMat = diffMat** 2 #两矩阵内的值的差,的平方 ex : (Xa0 - Xb0)**2 
    sqDistances = sqDiffMat.sum(axis=1) # axis = 1 矩阵的每一行里的值相加  axis = 0 矩阵的每一列里的值相加 (Xa0 - Xb0)**2 + (Xa1 - Xb1)**2 + ...
    distances = sqDistances ** 0.5 
    sortedDistIndices = distances.argsort() # 把算出来的距离从小到大排序,新矩阵数值大小的排名,值为原矩阵数值得indice
    classCount = {}
    for i in range(k):
        voteIlabel = labels[sortedDistIndices[i]] #把前k个距离对应的label找出来
        classCount[voteIlabel] = classCount.get(voteIlabel,0) + 1 # 对label计数
    sortedClassCount = sorted(classCount.items(),key=operator.itemgetter(1),reverse=True) #把label计数的字典排序 从高到低
    return sortedClassCount[0][0] #返回第一个
group,labels = createDataSet()
# 预测[0,0] 属于哪一类
classify0([0,0],group,labels,3)
'B'

2.2 示例:使用KNN算法提高约会网站的配对效果

数据源名称:datingTestSet.txt,datingTestSet2.txt

数据源地址:

https://github.com/pbharrin/machinelearninginaction/blob/master/Ch02/datingTestSet.txt

https://github.com/pbharrin/machinelearninginaction/blob/master/Ch02/datingTestSet2.txt

2.2.1 准备数据:从文本文件中解析数据

def file2matrix(filename):
    label = ['didntLike','smallDoses','largeDoses']
    fr = open(filename)
    arrayOLines = fr.readlines()
    numberOfLines = len(arrayOLines)
    returnMat = np.zeros((numberOfLines,3)) # 形成numberOfLines行,3列的数组,数组内每个值都为0
    classLabelVector = []
    index = 0
    for line in arrayOLines : 
        line = line.strip() #移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
        listFromLine = line.split('\t')
        returnMat[index,:] = listFromLine[0:3] #[0:3] 取0,1,2列。把分割好的line放入listFromline数组里
        classLabelVector.append(int(label.index(listFromLine[-1]))+1)
        index += 1
    return returnMat,classLabelVector

测试

datingDataMat, datingLabels = file2matrix(filename='datingTestSet.txt')
datingLabels[0:20]
[3, 2, 1, 1, 1, 1, 3, 3, 1, 3, 1, 1, 2, 1, 1, 1, 1, 1, 2, 3]

2.2.2 分析数据:使用Matplotlib创建散点图

import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111) #若参数为349,含义为:将画布分割成3行4列,图像画在从左到右从上到下的第9块,如下图: 
ax.scatter(datingDataMat[:,1],datingDataMat[:,2]) #取了datingDataMat第1列,和第2列
plt.show()

机器学习实战第二章 k-近邻算法

用颜色区分点

用第一列,第二列展示结果,用第一列第二列在第三列中对应的标签值作为第三维度来区分点

fig = plt.figure()
ax = fig.add_subplot(221) #若参数为349,含义为:将画布分割成3行4列,图像画在从左到右从上到下的第9块,如下图: 

# 不好的散点图:无颜色区分
# scatter参数内容:datingDataMat第一列,第二列在坐标系形成一个点
# ax.scatter(datingDataMat[:,1],datingDataMat[:,2]) #取了datingDataMat第1列,和第2列
ax.scatter(datingDataMat[:,1],datingDataMat[:,2], 15.0*np.array(datingLabels), 15.0*np.array(datingLabels)) #取了datingDataMat第1列,和第2列
ax.set_title('result of column 1,2')
Text(0.5,1,'result of column 1,2')

用第0列,第1列展示结果,用第0列第1列在第三列中对应的标签值作为第三维度来区分点

# 带颜色的散点图
# scatter参数内容:datingDataMat第一列,第二列在坐标系形成一个点
# 15.0*np.array(datingLabels)是第一列第二列中的值在第三列中的label值(ex : 1,2,3)
# 在scatter中对于第一列第二列的数据,都加上第三列的值即多一个维度,scatter会用颜色区分
ax2 = fig.add_subplot(222)
ax2.scatter(datingDataMat[:,0],datingDataMat[:,1],15.0*np.array(datingLabels),15.0*np.array(datingLabels))
ax2.set_title('result of column 0,1')
Text(0.5,1,'result of column 0,1')
plt.show()

机器学习实战第二章 k-近邻算法
用第0列、第1列展示的数据比第1列、第2列展示的数据更好,因为颜色在图中更集中。

2.2.3 准备数据:归一化数值

把任意特征取值转化为0到1之间:newValue = (oldValue - min)/(max - min)

min, max分别为数据集中的最大特征值和最小特征值

# 根据公式建立归一化函数
def autoNorm(dataSet):
    minVals = dataSet.min(0) #min(0):列内最小 min(1):行内最小
    maxVals = dataSet.max(0) #max(0):列内最大 max(1):行内最大
    ranges = maxVals - minVals # maxvalue - minvalue
    normDataSet = np.zeros(list(dataSet.shape)) 
    m = dataSet.shape[0]
    normDataSet = dataSet - np.tile(minVals,(m,1))  # oldvalue - minvalue
    normDataSet = normDataSet/np.tile(ranges,(m,1)) # oldvalue - minvalue/maxvalue - minvalue   /对应元素相处 np.linalg.solve()矩阵相除
    return normDataSet,ranges,minVals
datingDataMat.shape
(1000, 3)
normMat,ranges,minVals = autoNorm(datingDataMat)
normMat
array([[0.44832535, 0.39805139, 0.56233353],
       [0.15873259, 0.34195467, 0.98724416],
       [0.28542943, 0.06892523, 0.47449629],
       ...,
       [0.29115949, 0.50910294, 0.51079493],
       [0.52711097, 0.43665451, 0.4290048 ],
       [0.47940793, 0.3768091 , 0.78571804]])
ranges
array([9.1273000e+04, 2.0919349e+01, 1.6943610e+00])
minVals
array([0.      , 0.      , 0.001156])

2.2.4 测试算法:作为完整的程序验证分类器

把任意特征取值转化为0到1之间:newValue = (oldValue - min)/(max - min)

min, max分别为数据集中的最大特征值和最小特征值

def datingClassTest():
    hoRatio = 0.3 #要取出的训练集数据个数占总dataset的百分比
    datingDataMat, datingLabels = file2matrix('datingTestSet.txt')
    normMat, ranges, minval = autoNorm(datingDataMat) #归一化数据
    m = normMat.shape[0]  # 数据总行数
    numTestVecs = int(m*hoRatio) #测试集数据个数
    errorCount = 0.0 
    for i in range(numTestVecs):
        classifierResult = classify0(normMat[i,:],normMat[numTestVecs:,:],datingLabels[numTestVecs:],5)
        print("the classifier came back with : " + str(classifierResult) + ", the real anwser is : " + str(datingLabels[i]))
        if classifierResult != datingLabels[i]:
            errorCount += 1
    errorCount = errorCount/numTestVecs
    print("the error rate is : " + str(errorCount))
datingClassTest()
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 2, the real anwser is : 2
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 1, the real anwser is : 1
the classifier came back with : 3, the real anwser is : 3
the classifier came back with : 2, the real anwser is : 2
the error rate is : 0.07

如果改变k和测试集数据数量,会对错误率有影响

2.2.5 使用算法:构建完整可用系统

基于之前的datingClassTest,添加输入功能,使用户可以输入值,得到预测结果。

def datingClassTest():
    hoRatio = 0.1 #要取出的训练集数据个数占总dataset的百分比
    datingDataMat, datingLabels = file2matrix('datingTestSet.txt')
    normMat, ranges, minval = autoNorm(datingDataMat) #归一化数据
    m = normMat.shape[0]  # 数据总行数
    numTestVecs = int(m*hoRatio) #测试集数据个数
    errorCount = 0.0 
    percenTats = float(input("percentage of time spent playing video games ?"))
    ffMiles = float(input("frequent filier miles eraned per year ?"))
    iceCream = float(input("liters of ice cream consumed per year ?"))
    
    inX = np.array([ffMiles,percenTats,iceCream])
    inXNorm = (inX - minval)/ranges
    classifierResult = classify0(inXNorm,normMat[numTestVecs:,:],datingLabels[numTestVecs:],3)
    label = ['didntLike','smallDoses','largeDoses']
    print("the classifier came back with : " + label[classifierResult-1])
datingClassTest()
percentage of time spent playing video games ?10
frequent filier miles eraned per year ?10000
liters of ice cream consumed per year ?0.5
the classifier came back with : smallDoses

2.3 示例:使用手写识别系统

数据源名称:digits.zip

数据源地址:

https://github.com/pbharrin/machinelearninginaction/tree/master/Ch02

2.3.1 准备数据:将图像转换为测试向量

# 把图像数据 32行32列 转换为 1行1024列
def img2vector(filename):
    returnVect = np.zeros((1,1024))
    fr = open(filename)
    for i in range(32):
        lineStr = fr.readline() #运行一次读一行,再运行读下一行
        for j in range(32): #读每一行中的每一个数
            returnVect[0,32*i+j] = int(lineStr[j])
    return returnVect
#测试
res = img2vector('digits/trainingDigits/0_0.txt')
res2 = img2vector('digits/trainingDigits/0_1.txt')

2.3.2 测试算法:使用k-临近算法识别手写数字

数据理解:

文件内的值表示数字,即特征

文件标题的第一个数字,即为正确答案

自己写的版本

def handWritingClassTest():
    import os
    lst_doc_train = os.listdir('digits/trainingDigits/')
    lst_doc_test = os.listdir('digits/testDigits/')
    
    #整理features集
    featureTrain = []
    featureTest = []
    check = []
    for i in lst_doc_train:
        check.append(i)
        trainVector = img2vector('digits/trainingDigits/' + i)
        featureTrain.append(list(trainVector[0]))
    featureTrain = np.array(featureTrain)
    
    #整理label集
    labelTrain = []
    labelTest = []
    for i in lst_doc_train:
        i = int(i.split('_')[0])
        labelTrain.append(i)    
    for j in lst_doc_test:    
        j = int(j.split('_')[0])
        labelTest.append(j)
    
    #预测
    error = 0
    for i in lst_doc_test:
        returnVect = img2vector('digits/testDigits/'+i)
        returnVect = np.array(returnVect[0])
        classifierResult = classify0(inX=returnVect,dataSet=featureTrain,labels=labelTrain,k=3)
        print("the predict result is : " + str(classifierResult) + ", " + "the real answer is : " + str(labelTest[lst_doc_test.index(i)]))
        if labelTest[lst_doc_test.index(i)] != classifierResult:
            error += 1
    errorRate = error/len(lst_doc_test)
    print("error rate : " + str(errorRate))
handWritingClassTest()
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 0, the real answer is : 0
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 7, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 1, the real answer is : 1
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 2, the real answer is : 2
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 9, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 3, the real answer is : 3
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 4, the real answer is : 4
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 3, the real answer is : 5
the predict result is : 6, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 5, the real answer is : 5
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 6, the real answer is : 6
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 7, the real answer is : 7
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 6, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 3, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 1, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 1, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 8, the real answer is : 8
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 1, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 7, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
the predict result is : 9, the real answer is : 9
error rate : 0.010570824524312896

书上的版本

def handWritingClassTest2():
    import os
    hwLabels = []
    trainingFileList = os.listdir('digits/trainingDigits/')
    m = len(trainingFileList)
    trainingMat = np.zeros((m,1024))
    for i in range(m):
        fileNamestr = trainingFileList[i]
        fileStr = fileNamestr.split('.')[0]
        classNumStr = int(fileStr.split('_')[0])
        hwLabels.append(classNumStr)
        trainingMat[i,:] = img2vector('digits/trainingDigits/' + fileNamestr)
    testFileList = os.listdir('digits/testDigits/')
    errorCount = 0.0
    mTest = len(testFileList)
    for i in range(mTest):
        fileNamestr = testFileList[i]
        fileStr = fileNamestr.split('.')[0]
        classNumStr = int(fileStr.split('_')[0])
        vectorUnderTest = img2vector('digits/testDigits/' + fileNamestr)
        classifierResult = classify0(inX=vectorUnderTest,dataSet=trainingMat,labels=hwLabels,k=3)
        print("the classifier came back with : " + str(classifierResult) + ', the real value is : ' + str(classNumStr))
        if (classifierResult != classNumStr):
            errorCount += 1
    print("the error rate is : " + str(errorCount/mTest))
handWritingClassTest2()
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 0, the real value is : 0
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 7, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 1, the real value is : 1
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 2, the real value is : 2
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 9, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 3, the real value is : 3
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 4, the real value is : 4
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 3, the real value is : 5
the classifier came back with : 6, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 5, the real value is : 5
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 6, the real value is : 6
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 7, the real value is : 7
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 6, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 3, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 1, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 1, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 8, the real value is : 8
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 1, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 7, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the classifier came back with : 9, the real value is : 9
the error rate is : 0.010570824524312896