2

Sample code:

>>> 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() 

This code returns the following image: enter image description here

The following functions calculates the EER:

eer1 = bob.measure.eer_rocch(negatives, positives)

I would like to include this intersection "point" into the curve. I have tried with:

>>> 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() 

With no success. I would like to get a figure as in the following example: enter image description here

183.amir
  • 422
  • 3
  • 25
user3025898
  • 561
  • 1
  • 6
  • 19

1 Answers1

0

This was fixed in https://gitlab.idiap.ch/bob/bob.measure/-/merge_requests/95 and is included in new versions of bob.measure. To make sure the point falls on the plot, increase the number of points significantly.

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()

DET Plot

183.amir
  • 422
  • 3
  • 25