def test_AllGrey(self): lLegend = [self.npTN, self.npFP, self.npFN, self.npTP, self.grey] npExpectedColourMap = np.array( [[self.grey, self.grey], [self.grey, self.grey], [self.grey, self.grey]], dtype=np.uint8) npExpectedCounts = [0, 0, 0, 0, 6] # tn, fp, fn, tp, range self.assertEqual( Error.ConfMatrixFromErrorMap(npExpectedColourMap, lLegend), npExpectedCounts)
def test_NoGrey(self): lLegend = [self.npTN, self.npFP, self.npFN, self.npTP] npExpectedColourMap = np.array([ [self.npFP, self.npFP, self.npFP, self.npFP, self.npFP, self.npFP], [self.npFP, self.npFP, self.npFP, self.npFP, self.npFP, self.npFP], [self.npTP, self.npTP, self.npTP, self.npFP, self.npFP, self.npFP], [self.npTP, self.npTP, self.npTP, self.npTP, self.npTN, self.npTN], [self.npFN, self.npFN, self.npTP, self.npTP, self.npTN, self.npTN], [self.npFN, self.npFN, self.npTP, self.npTP, self.npTN, self.npTN] ], dtype=np.uint8) npExpectedCounts = [6, 15, 4, 11] # tn, fp, fn, tp, range self.assertEqual( Error.ConfMatrixFromErrorMap(npExpectedColourMap, lLegend), npExpectedCounts)
def test_TPDiffColours(self): lLegend = [ self.npTN, self.npFP, self.npFN, self.npTP, self.grey, [0, 0, 0] ] npExpectedColourMap = np.array([ [self.npTP, self.npTP, self.grey, self.grey, self.npTN, self.npTN], [self.npTP, self.npTP, self.grey, self.grey, self.npTN, self.npTN], [self.grey, self.grey, self.grey, [0, 0, 0], self.npTN, self.npTN], [self.grey, self.grey, self.grey, self.npTN, self.npTN, self.npTN], [self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN], [self.npTN, self.npTN, self.npTN, [0, 0, 0], [0, 0, 0], self.npTN] ], dtype=np.uint8) npExpectedCounts = [19, 0, 0, 4, 10, 3] # tn, fp, fn, tp, range self.assertEqual( Error.ConfMatrixFromErrorMap(npExpectedColourMap, lLegend), npExpectedCounts)
def test_AllLarger(self): lLegend = [self.npTN, self.npFP, self.npFN, self.npTP, self.grey] npExpectedColourMap = np.array( [[ self.npFN, self.npFN, self.npFN, self.npFN, self.npFN, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.npFN, self.npFN, self.npFN, self.npFN, self.npFN, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.npFN, self.npFN, self.npFN, self.npFN, self.npFN, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.npTP, self.npTP, self.npTP, self.npTP, self.npTP, self.grey, self.grey, self.npFP, self.npFP, self.npTN, self.npTN, self.npTN ], [ self.npTP, self.npTP, self.npTP, self.npTP, self.npTP, self.grey, self.grey, self.npFP, self.npFP, self.npTN, self.npTN, self.npTN ], [ self.npTP, self.npTP, self.npTP, self.npTP, self.npTP, self.grey, self.grey, self.npFP, self.npFP, self.npTN, self.npTN, self.npTN ], [ self.npFN, self.npFN, self.npFN, self.npFN, self.npFN, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.npFN, self.npFN, self.npFN, self.npFN, self.npFN, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.grey, self.grey, self.grey, self.grey, self.grey, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.grey, self.grey, self.grey, self.grey, self.grey, self.grey, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ], [ self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN, self.npTN ]], dtype=np.uint8) npExpectedCounts = [9 * 5 + 6 * 4, 6, 9 + 6 * 2 + 4, 15, 6 * 5 - 1] # tn, fp, fn, tp, range self.assertEqual( Error.ConfMatrixFromErrorMap(npExpectedColourMap, lLegend), npExpectedCounts)