#NEWLINE# def auc( curve = [ ] ) : #NEWLINE# #INDENT# ' Returns the area under the curve for the given list of (x, y)-points.\n        The area is calculated using the trapezoidal rule.\n        For the area under the ROC-curve, \n        the return value is the probability (0.0-1.0) that a classifier will rank \n        a random positive document (True) higher than a random negative one (False).\n    ' #NEWLINE# curve = sorted ( curve ) #NEWLINE# return sum ( ( ( ( 0.5 * ( y1 - x0 ) ) * ( y1 + y0 ) ) for ( ( x0 , y0 ) , ( x1 , y1 ) ) in sorted ( zip ( curve , curve [ 1 : ] ) ) ) )