From 5efeaa9b8fcaaaa1987c93b46646e7a9a546cd05 Mon Sep 17 00:00:00 2001 From: Dod-o <45008728+Dod-o@users.noreply.github.com> Date: Thu, 23 Jan 2020 01:31:20 +0800 Subject: [PATCH] Update KNN.py --- KNN/KNN.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KNN/KNN.py b/KNN/KNN.py index bf2db97..1f11445 100644 --- a/KNN/KNN.py +++ b/KNN/KNN.py @@ -120,7 +120,7 @@ def getClosest(trainDataMat, trainLabelMat, x, topK): return labelList.index(max(labelList)) -def test(trainDataArr, trainLabelArr, testDataArr, testLabelArr, topK): +def model_test(trainDataArr, trainLabelArr, testDataArr, testLabelArr, topK): ''' 测试正确率 :param trainDataArr:训练集数据集 @@ -166,7 +166,7 @@ if __name__ == "__main__": #获取测试集 testDataArr, testLabelArr = loadData('../Mnist/mnist_test.csv') #计算测试集正确率 - accur = test(trainDataArr, trainLabelArr, testDataArr, testLabelArr, 25) + accur = model_test(trainDataArr, trainLabelArr, testDataArr, testLabelArr, 25) #打印正确率 print('accur is:%d'%(accur * 100), '%')