def test_misclassified(self): data = readAllData(SHORT_FILE_NAME) average = computeAverageForClasses(data) misclasified = misclassified(data) result_data = [('15.24850737', 'NO'), ('13.195037', 'NO')] self.assertEqual(misclasified, result_data)
from functions import readAllData, computeAverageForClasses, misclassified # file name FILE_NAME = 'short_data.txt' #read data data = readAllData(FILE_NAME) # average average = computeAverageForClasses(data) print('Average:') print(average) # misclassified misclasified = misclassified(data) print('Misclassified:') print(len(misclasified)) # file write write_data = [ f'{m[0]}\t{m[1]}' for m in misclasified ] f = open("Misclassified.txt", "w") f.write('\n'.join(write_data)) f.close()
def test_misclassified_complete_final(self): data = readAllData(COMPLETE_FINAL_FILE_NAME) average = computeAverageForClasses(data) misclasified = misclassified(data) self.assertEqual(len(misclasified), 36)