def AUCError(errors, failureThreshold, step=0.0001, showCurve=False):
nErrors = len(errors)
xAxis = list(np.arange(0., failureThreshold + step, step))
ced = [float(np.count_nonzero([errors <= x])) / nErrors for x in xAxis]
AUC = simps(ced, x=xAxis) / failureThreshold
failureRate = 1. - ced[-1]
print "AUC @ {0}: {1}".format(failureThreshold, AUC)
print "Failure rate: {0}".format(failureRate)
if showCurve:
plt.plot(xAxis, ced)
plt.show()
评论列表
文章目录