def biased_out(prediction, bias):
out = []
b_pres = []
for pre in prediction:
b_pres.append(pre[:,0] - pre[:,1])
props = np.concatenate(b_pres)
props = np.sort(props)[::-1]
idx = int(bias*len(props))
if idx == len(props):
idx -= 1
th = props[idx]
print 'threshold: ', th, 1 / (1 + np.exp(-th))
for pre in b_pres:
pre[pre >= th] = 0
pre[pre != 0] = 1
out.append(pre)
return out
评论列表
文章目录