MCPcopy Index your code
hub / github.com/clips/pattern / auc

Function auc

pattern/metrics.py:200–209  ·  view source on GitHub ↗

Returns the area under the curve for the given list of (x, y)-points. The area is calculated using the trapezoidal rule. For the area under the ROC-curve, the return value is the probability (0.0-1.0) that a classifier will rank a random positive document (True) hi

(curve=[])

Source from the content-addressed store, hash-verified

198 return sorted([(0.0, 0.0), (1.0, 1.0)] + [(x(*m), y(*m)) for m in tests])
199
200def auc(curve=[]):
201 """ Returns the area under the curve for the given list of (x, y)-points.
202 The area is calculated using the trapezoidal rule.
203 For the area under the ROC-curve,
204 the return value is the probability (0.0-1.0) that a classifier will rank
205 a random positive document (True) higher than a random negative one (False).
206 """
207 curve = sorted(curve)
208 # Trapzoidal rule: area = (a + b) * h / 2, where a=y0, b=y1 and h=x1-x0.
209 return sum(0.5 * (x1 - x0) * (y1 + y0) for (x0, y0), (x1, y1) in sorted(izip(curve, curve[1:])))
210
211#### AGREEMENT #####################################################################################
212# +1.0 = total agreement between voters

Callers

nothing calls this directly

Calls 1

sumFunction · 0.85

Tested by

no test coverage detected