def auc(self, k=10):
        roc = [(0.0, 0.0), (1.0, 1.0)]
        for type, TP, TN, FP, FN in self.split():
            x = FPR = float(FP) / ((FP + TN) or 1) # false positive rate
            y = TPR = float(TP) / ((TP + FN) or 1) #  true positive rate
            roc.append((x, y))
            #print("%s\t%s %s %s %s\t %s %s" % (TP, TN, FP, FN, FPR, TPR))
        roc = sorted(roc)
        # Trapzoidal rule: area = (a + b) * h / 2, where a=y0, b=y1 and h=x1-x0.
        return sum(0.5 * (x1 - x0) * (y1 + y0) for (x0, y0), (x1, y1) in sorted(zip(roc, roc[1:])))
Helper for fetching features from random region number_of_repeats
dataset/ETHPy150Open clips/pattern/pattern/vector/__init__.py/ConfusionMatrix.auc--crossover with--dataset/ETHPy150Open daler/gffutils/gffutils/test/performance_test.py/PerformanceTestFeatureDB.region_fetch_helper