def al_crowd_fin_expert(adata, clf, turk_uncer, crowd_budget = 5*1500):
if adata.spent_crowd < crowd_budget and len(adata.rel) > 0:
res = al_just_crowd(adata, clf)
if res != -1: return res
print "q expert"
n = len(adata.taken_items)
crowd_prob = np.zeros(n)
found = False
for i in range(n):
if not adata.expert_fixed[i]:
found = True
j = adata.taken_items[i]
crowd_prob[i] = turk_uncer[j][0] *1.0/ (turk_uncer[j][0] + turk_uncer[j][1])
else:
crowd_prob[i] = 100
if not found: return -1
uncertain = np.abs(crowd_prob - 0.5)
i = np.argmin(uncertain)
#print i, adata.expert_fixed[i]
print "most", turk_uncer[adata.taken_items[i]]
return adata.query_expert_fix(i)
评论列表
文章目录