示例代码:
>>> from matplotlib import pyplot
>>> import bob.measure
>>> positives = np.random.normal(1,1,100)
>>> negatives = np.random.normal(-1,1,100)
>>> # we assume you have your negatives and positives already split
>>> npoints = 100
>>> bob.measure.plot.det(negatives, positives, npoints, color=(0,0,0), linestyle='-', label='test')
>>> bob.measure.plot.det_axis([0.01, 40, 0.01, 40])
>>> pyplot.xlabel('FAR (%)')
>>> pyplot.ylabel('FRR (%)')
>>> pyplot.grid(True)
>>> pyplot.show()
以下函数计算EER:
eer1 = bob.measure.eer_rocch(negatives, positives)
我想包括这个交叉点"点"进入曲线。 我尝试过:
>>> from matplotlib import pyplot
>>> import bob.measure
>>> positives = np.random.normal(1,1,100)
>>> negatives = np.random.normal(-1,1,100)
>>> # we assume you have your negatives and positives already split
>>> npoints = 100
>>> bob.measure.plot.det(negatives, positives, npoints, color=(0,0,0), linestyle='-', label='test')
>>> bob.measure.plot.det_axis([0.01, 40, 0.01, 40])
>>> pyplot.plot(eer1,eer1)
>>> pyplot.xlabel('FAR (%)')
>>> pyplot.ylabel('FRR (%)')
>>> pyplot.grid(True)
>>> pyplot.show()
答案 0 :(得分:0)
此问题已在 https://gitlab.idiap.ch/bob/bob.measure/-/merge_requests/95 中修复并包含在 bob.measure 的新版本中。为确保该点落在绘图上,请显着增加点数。
from matplotlib import pyplot
import bob.measure
import numpy as np
npoints = 1000 # use a large number here
positives = np.random.normal(1,1,100)
negatives = np.random.normal(-1,1,100)
bob.measure.plot.det(negatives, positives, npoints, color=(0,0,0), linestyle='-', label='test')
bob.measure.plot.det_axis([0.01, 40, 0.01, 40])
eer1 = bob.measure.eer(negatives, positives)
# DET plots are in log scale, use ppndf to convert the point
eer2 = bob.measure.ppndf(eer1)
pyplot.plot(eer2, eer2, "o", label=f"EER={eer1*100}%")
pyplot.xlabel('FAR (%)')
pyplot.ylabel('FRR (%)')
pyplot.grid(True)
pyplot.legend()
pyplot.show()