KNN二进制数字分类 单独的泡菜数据 所有泡菜数据均来自MNIST手写数字数据库 import pickle import numpy as np import matplotlib . pyplot as plt import sklearn . neighbors as nb with open ( "mnistTVT.pickle" , "rb" ) as f : Xtrain , Ttrain , Xval , Tval , Xtest , Ttest = pickle . load ( f ) # reduce training data to contain only digits d1 and d2 def reduce_data ( d1 , d2 , xtrain , ttrain , xval , tval , xtest , ttest ): # fu