# cvs format #fileParser.parseDBData("db_car.txt") #fileParser.printDBData() # weka format fileParser.buildFileDescription("car.data", "db_car.txt") fileParser.parseFileDescription("db_car.txt") fileParser.parseCVSPatterns("car.data") fileParser.parseCVS2Numeric("car_numeric.data") fileParser.convertTestFileNumeric("car-prueba.data", "car-prueba_numeric.data") classifier = NaiveBayesClassifier(fileParser) classifier.train(fileParser.fvector, fileParser.label) #classifier.printTables() classifier.testFile("car-prueba.data") #input_data = ['vhigh', 'vhigh', 2, 2, 'med', 'med', 'unacc'] #classifier.test(input_data) #input_data = ['low', 'high', 4, 4, 'big', 'med', 'acc'] #classifier.test(input_data)
from lib.NaiveBayesClassifier import NaiveBayesClassifier from lib.FileParser import FileParser fileParser = FileParser() fileParser.parseFileDescription("db_tennis.txt") #fileParser.printDBData() fileParser.parseCVSPatterns("tennis.data") #fileParser.printPatterns() classifier = NaiveBayesClassifier(fileParser) classifier.train(fileParser.fvector, fileParser.label) #classifier.printTables() ################## VALIDACION input_data = ['Sunny', 'Cool', 'High', 'Strong', 'No'] classifier.test(input_data)