Python机器学习实战之k-近邻算法的实现


Posted in Python onNovember 27, 2021

K-近邻算法概述

简单地说, k-近邻算法采用测量不同特征值之间的距离方法进行分类。

k-近邻算法

  • 优点:精度高、对异常值不敏感、无数据输入假定。
  • 缺点: 计算复杂度高、空间复杂度高。

适用数据范围: 数值型和标称型。

工作原理

  • 存在一个样本数据集合, 也称作训练样本集, 并且样本集中每个数据都存在标签, 知道样本集中每一数据与所属分类的对应关系。
  • 输入没有标签的新数据后, 将新数据的每个特征与样本集中数据对应的特征进行比较, 然后算法提取样本集中特征最相似数据 (最近邻)的分类标签。
  • 一般来说, 只选择样本数据集中前 k个最相似的数据, 这就是k-近邻算法中k的出处, 通常 k 是不大于 20 的整数。
  • 最后, 选择 k个最相似数据中出现次数最多的分类, 作为新数据的分类。

k-近邻算法的一般流程

  1. 收集数据: 可以使用任何方法。
  2. 准备数据: 距离计算所需要的数值, 最好是结构化的数据格式。
  3. 分析数据: 可以使用任何方法。
  4. 训练算法: 此步骤不适用于 k-近邻算法。
  5. 测试算法: 计算错误率。
  6. 使用算法: 首先需要输入样本数据和结构化的输出结果, 然后运行 k-近邻算法判定输 入数据分别属于哪个分类, 最后应用对计算出的分类执行后续的处理。
from numpy import *
import operator
def createDataSet():
    group = array([[1.0,1.1],[1.0,1.0],[0,0],[0,0.1]])
    labels = ['A','A','B','B']
    return group, labels
group, labels = createDataSet()
group
array([[1. , 1.1],
       [1. , 1. ],
       [0. , 0. ],
       [0. , 0.1]])
labels
['A', 'A', 'B', 'B']
a = tile([3,3],(4,1))
a
array([[3, 3],
       [3, 3],
       [3, 3],
       [3, 3]])

实施KNN算法

其伪代码如下:

对末知类别属性的数据集中的每个点依次执行以下操作:

  1. 计算已知类别数据集中的点与当前点之间的距离;
  2. 按照距离递增次序排序;
  3. 选取与当前点距离最小的k个点;
  4. 确定前k个点所在类别的出现频率;
  5. 返回前k个点出现频率最高的类别作为当前点的预测分类。
def classify0(inX, dataSet, labels, k):
    dataSetSize = dataSet.shape[0]
    diffMat = tile(inX,(dataSetSize,1)) - dataSet
    sqDiffMat = diffMat**2
    sqDistances = sqDiffMat.sum(axis=1)
    distances = sqDistances**0.5
    sortedDistIndicies = distances.argsort()
    classCount = {}
    for i in range(k):
        voteIlabel = labels[sortedDistIndicies[i]]
        classCount[voteIlabel] = classCount.get(voteIlabel,0) + 1
    sortedClassCount = sorted(classCount.items(),key = operator.itemgetter(1), reverse=True)
    return sortedClassCount[0][0]
classify0([0,0],group,labels,3)
'B'

示例:手写识别系统

数据集如下图:

Python机器学习实战之k-近邻算法的实现

示例: 使用k-近邻算法的手写识别系统

  1. 收集数据: 提供文本文件。
  2. 准备数据: 编写函数 classify0(), 将图像格式转换为分类器使用的list格式。
  3. 分析数据: 在Python命令提示符中检查数据, 确保它符合要求。
  4. 训练算法: 此步骤不适用于 k-近邻算法。
  5. 测试算法: 编写函数使用提供的部分数据集作为测试样本, 测试样本与非测试样本 的区别在于测试样本是已经完成分类的数据, 如果预测分类与实际类别不同, 则标记 为一个错误。
  6. 使用算法:本例没有完成此步骤,若你感兴趣可以构建完整的应用程序,从图像中提 取数字, 并完成数字识别, 美国的邮件分栋系统就是一个实际运行的类似系统。

图像转换为向量 

def img2vector(filename):
    returnVect = 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
testVector = img2vector('digits/testDigits/0_13.txt')
testVector[0,0:31]
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 1., 1.,
       1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
from os import listdir
def handwritingClassTest():
    hwLables = []
    trainingFileList = listdir('digits/trainingDigits')
    m = len(trainingFileList)
    trainingMat = zeros((m,1024))
    for i in range(m):
        fileNameStr = trainingFileList[i]
        fileStr = fileNameStr.split('.')[0]
        classNumStr = int(fileStr.split('_')[0])
        hwLables.append(classNumStr)
        trainingMat[i,:] = img2vector('digits/trainingDigits/%s' % fileNameStr)
    testFileList = 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/%s' % fileNameStr)
        classifierResult = classify0(vectorUnderTest, trainingMat,hwLables,3)
        print("the classifier came back width: %d, the real answer is: %d" % (classifierResult,classNumStr))
        if(classifierResult != classNumStr):
            errorCount += 1.0
    print("\nthe total number of errors is :%d" % errorCount)
    print("\nthe total error rate is:%f" % (errorCount/float(mTest)))
handwritingClassTest()
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 1
the classifier came back width: 7, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 9, the real answer is: 3
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 7, the real answer is: 7
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 9, the real answer is: 9
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 6, the real answer is: 6
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 3, the real answer is: 3
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 1, the real answer is: 1
the classifier came back width: 2, the real answer is: 2
the classifier came back width: 8, the real answer is: 8
the classifier came back width: 4, the real answer is: 4
the classifier came back width: 0, the real answer is: 0
the classifier came back width: 5, the real answer is: 5
the classifier came back width: 8, the real answer is: 8

the total number of errors is :10

the total error rate is:0.010571

以上就是Python机器学习实战之k-近邻算法的实现的详细内容,更多关于Python k-近邻算法的资料请关注三水点靠木其它相关文章!

Python 相关文章推荐
Python实现批量下载图片的方法
Jul 08 Python
python实现给数组按片赋值的方法
Jul 28 Python
详解Python操作RabbitMQ服务器消息队列的远程结果返回
Jun 30 Python
Python运算符重载详解及实例代码
Mar 07 Python
python进阶_浅谈面向对象进阶
Aug 17 Python
Python实现按特定格式对文件进行读写的方法示例
Nov 30 Python
Python3使用SMTP发送带附件邮件
Jun 16 Python
Python_查看sqlite3表结构,查询语句的示例代码
Jul 17 Python
Django中间件拦截未登录url实例详解
Sep 03 Python
TensorFlow实现从txt文件读取数据
Feb 05 Python
使用keras实现densenet和Xception的模型融合
May 23 Python
Django rest framework如何自定义用户表
Jun 09 Python
Python Django项目和应用的创建详解
python playwright 自动等待和断言详解
Nov 27 #Python
Python实现制作销售数据可视化看板详解
Python 如何利用ffmpeg 处理视频素材
实操Python爬取觅知网素材图片示例
Python函数中apply、map、applymap的区别
Nov 27 #Python
python字符串拼接.join()和拆分.split()详解
Nov 23 #Python
You might like
QueryPath PHP 中的jQuery
2010/04/11 PHP
php header功能的使用
2013/10/28 PHP
PHP中overload与override的区别
2017/02/13 PHP
PHP实现表单提交数据的验证处理功能【防SQL注入和XSS攻击等】
2017/07/21 PHP
仿jQuery的siblings效果的js代码
2011/08/09 Javascript
JS获取select-option-text_value的方法
2013/12/26 Javascript
javascript中的__defineGetter__和__defineSetter__介绍
2014/08/15 Javascript
Lua表达式和控制结构学习笔记
2014/12/15 Javascript
JQuery控制radio选中和不选中方法总结
2015/04/15 Javascript
浅析Node.js中的内存泄漏问题
2015/06/23 Javascript
jquery点击改变class并toggle的实现代码
2016/05/15 Javascript
Bootstrap模态框插入视频的实现代码
2017/06/25 Javascript
详解express与koa中间件模式对比
2017/08/07 Javascript
vue.js 获取select中的value实例
2018/03/01 Javascript
小程序显示弹窗时禁止下层的内容滚动实现方法
2019/03/20 Javascript
详解一次Vue低版本安卓白屏问题的解决过程
2019/05/30 Javascript
vue的hash值原理也是table切换实例代码
2020/12/14 Vue.js
[53:15]2018DOTA2亚洲邀请赛3月29日 小组赛A组 KG VS OG
2018/03/30 DOTA
django小技巧之html模板中调用对象属性或对象的方法
2018/11/30 Python
python实现合并两个排序的链表
2019/03/03 Python
Pytorch使用MNIST数据集实现基础GAN和DCGAN详解
2020/01/10 Python
Python json模块与jsonpath模块区别详解
2020/03/05 Python
浅谈python 调用open()打开文件时路径出错的原因
2020/06/05 Python
python和php哪个容易学
2020/06/19 Python
Tensorflow全局设置可见GPU编号操作
2020/06/30 Python
HTML5新特性之语义化标签
2017/10/31 HTML / CSS
Bailey帽子官方商店:Bailey Hats
2018/09/25 全球购物
Java的五个基础面试题
2016/02/26 面试题
如何用Java实现列出某个目录下的所有子目录
2015/07/20 面试题
门卫班长岗位职责
2013/12/15 职场文书
机械专业应届毕业生自荐书
2014/06/12 职场文书
自动化专业毕业生求职信
2014/06/18 职场文书
党校党性分析材料
2014/12/19 职场文书
初中地理教学反思
2016/02/19 职场文书
安全责任协议书范本
2016/03/23 职场文书
pandas中pd.groupby()的用法详解
2022/06/16 Python