def TrainAndTestMultiDigitsPerceptron(): digits = [i for i in xrange(0, 10)] print "Running the Multi Digits Perceptron" print "the digits it shall descriminate between: " + digits.__str__() print "Extracting the Training Data" img, lbl = rn.getData(digits, "training") print "Training the Multi Digit Perceptron:" MulitDigitPerc = pr.MultiDigitPerceptron(digits, img, lbl, int(alpha * len(lbl))) print "Error on the Training data: " print str(pr.TestClassifier(img, lbl, MulitDigitPerc) * 100.0) + "%" print "Extracting the Testing Data" img, lbl = rn.getData(digits, "testing") print "False Classification on the Testing data: " + str( pr.TestClassifier(img, lbl, MulitDigitPerc) * 100.0) + "%"
def TrainAndTestWeakMultiDigitPerceptron(): digits = [i for i in xrange(0, 10)] print "Running the Weak Multi Digit Perceptron" fullimg, lbl = rn.getData(digits, "training") reducedList = rn.getReductionList(colnum, rownum) img = rn.ReduceSetDimension(reducedList, fullimg) perc = pr.MultiDigitPerceptron(digits, img, lbl, int(alpha * len(lbl))) print "Error on the Training data: " + str( pr.TestClassifier(img, lbl, perc) * 100.0) + "%" print "(out of " + str(len(lbl)) + " samples)" print "Extracting the Testing Data" fullimg, lbl = rn.getData(digits, "testing") img = rn.ReduceSetDimension(reducedList, fullimg) print "Error on the Testing data: " + str( pr.TestClassifier(img, lbl, perc) * 100.0) + "%" print "(out of " + str(len(lbl)) + " samples)"