From dab0508530bb34b0ff7634bba43b9345428f4c90 Mon Sep 17 00:00:00 2001 From: Jon Whiteaker Date: Fri, 2 Mar 2012 18:22:30 -0800 Subject: new face pr curve --- data/face-frame-recognition-accuracy.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'data/face-frame-recognition-accuracy.py') diff --git a/data/face-frame-recognition-accuracy.py b/data/face-frame-recognition-accuracy.py index 3ff0aa8..48b6141 100755 --- a/data/face-frame-recognition-accuracy.py +++ b/data/face-frame-recognition-accuracy.py @@ -3,6 +3,7 @@ import numpy as np import os import sys import pickle +import math prun = 0 runs = {} @@ -39,18 +40,26 @@ for line in open(sys.argv[2]): runs[prun] = recs.index(max(recs))+1 recs = map(lambda x:0,users) recs[users.index(rec)] += 1 - conf[run] = float(line[7]) + maxc = float(line[7])/100.0 + i = 9 + cvec = [] + while len(cvec) < len(users)-1: + if i < len(line): + cvec += [float(line[i])/100.0 - maxc] + else: + cvec += [-maxc] + conf[run] = math.log(np.sum(np.exp(cvec))) prun = run for i in range(999)+list(np.arange(999,1000,0.01)): - thresh = i/10 + thresh = 5-i/100.0 t=0.0 tp=0.0 fp=0.0 fn=0.0 for (k,v) in runs.items(): #print v,labels[k] - if conf[k] < thresh: + if conf[k] > thresh: fn += 1 elif v != labels[k]: fp += 1 -- cgit v1.2.3-70-g09d2