def eer_bob_rocch(impostors, genuines, is_sorted=False): """ EER function that wraps LDIAP's bob.measure toolkit EER function. :param impostors: An iterable of impostor scores :param genuines: An iterable of genuine scores :param is_sorted: Bool indicating if iterable is sorted :return: EER """ return eer_rocch(impostors, genuines)
def bootstrap_sorted_bob(impostors, genuines, m=1): eers = [0] * m impostors = np.array(sorted(impostors)) genuines = np.array(sorted(genuines)) for c_iter in range(m): imps = bootstrap_draw_sorted(impostors) gens = bootstrap_draw_sorted(genuines) eers[c_iter] = eer_rocch(imps, gens) return eers
def bootstrap_naive_bob(impostors, genuines, m=1): eers = [0] * m max_rounds = 20 i = 0 # It is more time efficient to generate more sample draws in one call to the numpy api. However, # this comes at considerable cost in memory (10,000 * 100,000 32-bit scores is 4 GB for example). # Therefore, we try to strike a balance between memory and computation. for i in range(int(m / max_rounds)): imps = np.random.choice(impostors, (max_rounds, len(impostors))) gens = np.random.choice(genuines, (max_rounds, len(genuines))) for c_iter in range(max_rounds): eers[c_iter + i * max_rounds] = eer_rocch(imps[c_iter, :], gens[c_iter, :]) imps = np.random.choice(impostors, (m % max_rounds, len(impostors))) gens = np.random.choice(genuines, (m % max_rounds, len(genuines))) for c_iter in range(m % max_rounds): eers[c_iter + (i + 1) * max_rounds] = eer_rocch( imps[c_iter, :], gens[c_iter, :]) return eers
def bootstrap_naive_rocch(impostors, genuines): imps = bootstrap_draw_sorted(impostors) gens = bootstrap_draw_sorted(genuines) return eer_rocch(imps, gens)
def bootstrap_naive_bob_once(imps, gens): return eer_rocch(imps, gens)