'Test the classifier.
images paramater can take in a list of paths or a list of imagesets
images - the order of the paths or imagesets must be in the same order as the class type
- Note all image classes must be in seperate directories
- The class names must also align to the directories or imagesets
disp - if display is a display we show images and class label,
otherwise nothing is done.
subset - if subset = -1 we use the whole dataset. If subset = # then we
use min(#images,subset)
savedata - if save data is None nothing is saved. If savedata is a file
name we save the data to a tab delimited file.
verbose - print confusion matrix and file names
returns [%Correct %Incorrect Confusion_Matrix]'

def test(self, images, classNames, disp=None, subset=(-1), savedata=None, verbose=True):

    count = 0
    correct = 0
    self.mClassNames = classNames
    colNames = []
    for extractor in self.mFeatureExtractors:
        colNames.extend(extractor.getFieldNames())
        if (self.mOrangeDomain is None):
            self.mOrangeDomain = orange.Domain(map(orange.FloatVariable, colNames), orange.EnumVariable('type', values=self.mClassNames))
    dataset = []
    for i in range(len(classNames)):
        if isinstance(images[i], str):
            [dataset, cnt, crct] = self._testPath(images[i], classNames[i], dataset, subset, disp, verbose)
            count = (count + cnt)
            correct = (correct + crct)
        else:
            [dataset, cnt, crct] = self._testImageSet(images[i], classNames[i], dataset, subset, disp, verbose)
            count = (count + cnt)
            correct = (correct + crct)
    testData = orange.ExampleTable(self.mOrangeDomain, dataset)
    if (savedata is not None):
        orange.saveTabDelimited(savedata, testData)
    confusion = 0
    if (len(self.mClassNames) > 2):
        crossValidator = orngTest.learnAndTestOnTestData([self.mLearner], self.mDataSetOrange, testData)
        confusion = orngStat.confusionMatrices(crossValidator)[0]
    good = (100 * (float(correct) / float(count)))
    bad = (100 * (float((count - correct)) / float(count)))
    if verbose:
        print ('Correct:    ' + str(good))
        print ('Incorrect:    ' + str(bad))
        if (confusion != 0):
            classes = self.mDataSetOrange.domain.classVar.values
            print (' DCTB ' + ' DCTB '.join(classes))
            for (className, classConfusions) in zip(classes, confusion):
                print (('%s' + (' DCTB %i' * len(classes))) % ((className,) + tuple(classConfusions)))
    return [good, bad, confusion]
