Skip to content

Instantly share code, notes, and snippets.

@jkarnows
Created September 3, 2017 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkarnows/b74fb93e9759a68c4cbae04ad2cf9724 to your computer and use it in GitHub Desktop.
Save jkarnows/b74fb93e9759a68c4cbae04ad2cf9724 to your computer and use it in GitHub Desktop.
Plotting a DET Curve
from matplotlib import pyplot as plt
def DETCurve(fps,fns):
"""
Given false positive and false negative rates, produce a DET Curve.
The false positive rate is assumed to be increasing while the false
negative rate is assumed to be decreasing.
"""
axis_min = min(fps[0],fns[-1])
fig,ax = plt.subplots()
plot(fps,fns)
yscale('log')
xscale('log')
ticks_to_use = [0.001,0.002,0.005,0.01,0.02,0.05,0.1,0.2,0.5,1,2,5,10,20,50]
ax.get_xaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
ax.get_yaxis().set_major_formatter(matplotlib.ticker.ScalarFormatter())
ax.set_xticks(ticks_to_use)
ax.set_yticks(ticks_to_use)
axis([0.001,50,0.001,50])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment