def test_1NN(digitsdat, selected, all_test_m): for testm in all_test_m: classifier = Classifier() classifier.build_model(digitsdat.X[selected[0:testm], :], digitsdat.y[ selected[0:testm]]) print("m=%d error=%f" % ( testm, classifier.classify(digitsdat.testX, digitsdat.testy)))
def test_1NN(digitsdat, selected, all_test_m): for testm in all_test_m: classifier = Classifier() # model = build(digitsdat.X[selected[0:testm], :], digitsdat.y[selected[0:testm]]) classifier.build_model(digitsdat.X[selected[0:testm], :], digitsdat.y[selected[0:testm]]) error = classifier.classify(digitsdat.testX, digitsdat.testy) # accuracy = res(model) # print("m=%d error=%f" % (testm, 100-accuracy)) print("m=%d error=%f" % (testm, error)) # global M, e M.append(testm) e.append(error)