test_3b, test_4, test_5, test_5b, test_6, test_6b, test_7, #test_7b, test_8, #test_8b, test_9 ) #test_9b) #, test_7b) #test2_a, train3_a, test4_a, test5_a, test6_a, test7_a, test8_a, test9_a) # for when each digit has 3 sets # trainX, trainy = ReshapeData(train0_a, train0_b, train0_c, train1_a, train1_b, train1_c, train2_a, train2_b, train2_c, train3_a, train3_b, train3_c, train4_a, train4_b, train4_c, train5_a, train5_b, train5_c, train6_a, train6_b, train6_c, train7_a, train7_b, train7_c, train8_a, train8_b, train8_c, train9_a, train9_b, train9_c) # testX, testy = ReshapeData(test0_a, test0_b, test0_c, test1_a, test1_b, test1_c, test2_a, test2_b, test2_c, test3_a, test3_b, test3_c, test4_a, test4_b, test4_c, test5_a, test5_b, test5_c, test6_a, test6_b, test6_c, test7_a, test7_b, test7_c, test8_a, test8_b, test8_c, test9_a, test9_b, test9_c) knn.Use_K_Of(100) # originally 15 knn.Fit(trainX, trainy) counter = 0 print(testX) print(testy) print(testX.shape, testy.shape) count0 = 0 count1 = 0 count2 = 0 count3 = 0 count4 = 0 count5 = 0 count6 = 0 count7 = 0
X[:, :, 2, :] = allZCoordinates - meanValue return X train3 = ReduceData(train3) train4 = ReduceData(train4) test3 = ReduceData(test3) test4 = ReduceData(test4) train3 = CenterData(train3) train4 = CenterData(train4) test3 = CenterData(test3) test4 = CenterData(test4) trainX, trainy = ReshapeData(train3, train4) testX, testy = ReshapeData(test3, test4) knn = knn.KNN() knn.Use_K_Of(15) knn.Fit(trainX, trainy) correctPredictions = 0 for row in range(0, 2000): actualClass = testy[row] prediction = knn.Predict(testX[row]) if (actualClass == prediction): correctPredictions = correctPredictions + 1 print(correctPredictions) print((correctPredictions / 2000) * 100)
testX, testy = ReshapeData(test0_a, test0_b, test0_c, test1_a, test1_b, test1_c, test2_a, test2_b, test2_c, #test3_a, test4_a, test4_b, test4_c, test5_a, test5_b, test5_c, test6_a, test6_b, test6_c, test7_a, test7_b, test7_c, test8_a, test8_b, test8_c, test9_a, test9_b, test9_c) # for when each digit except for 3 gets 3 sets, because 3 is being a little shit knn.Use_K_Of(175) # originally 15 knn.Fit(trainX, trainy) counter = 0 print(testX) print(testy) print(testX.shape, testy.shape) count0 = 0 count1 = 0 count2 = 0 count3 = 0 count4 = 0 count5 = 0 count6 = 0 count7 = 0