def roc(tests=[]):
 x = FPR = (lambda TP, TN, FP, FN: (float(FP) / ((FP + TN) or 1)))
 y = TPR = (lambda TP, TN, FP, FN: (float(TP) / ((TP + FN) or 1)))
 return sorted(([(0.0, 0.0), (1.0, 1.0)] + [(x(*m), y(*m)) for m in tests]))

def roc ( tests = [ ] ) : x = FPR = ( lambda TP , TN , FP , FN : ( float ( FP ) / ( ( FP + TN ) or 1 ) ) ) y = TPR = ( lambda TP , TN , FP , FN : ( float ( TP ) / ( ( TP + FN ) or 1 ) ) ) return sorted ( ( [ ( 0.0 , 0.0 ) , ( 1.0 , 1.0 ) ] + [ ( x ( * m ) , y ( * m ) ) for m in tests ] ) )
returns the roc curve as an iterator of -points .