def choose_image(annotator, items_map, annotators):
    pref_items = preferred_items(annotator, items_map, annotators)

    shuffle(pref_items)  # useful for argmax case as well in the case of ties
    if pref_items:
        if random() < crowd_bt.EPSILON:
            return pref_items[0]
        else:
            return crowd_bt.argmax(
                lambda i: crowd_bt.expected_information_gain(
                    annotator.alpha, annotator.beta, annotator.prev.mu,
                    annotator.prev.sigma_sq, i.mu, i.sigma_sq), pref_items)
    else:
        return None
예제 #2
0
파일: judge.py 프로젝트: anishathalye/gavel
def choose_next(annotator):
    items = preferred_items(annotator)

    shuffle(items) # useful for argmax case as well in the case of ties
    if items:
        if random() < crowd_bt.EPSILON:
            return items[0]
        else:
            return crowd_bt.argmax(lambda i: crowd_bt.expected_information_gain(
                annotator.alpha,
                annotator.beta,
                annotator.prev.mu,
                annotator.prev.sigma_sq,
                i.mu,
                i.sigma_sq), items)
    else:
        return None
예제 #3
0
def choose_next(annotator, annotator_category):
    items = preferred_items(annotator, annotator_category)

    shuffle(items)  # useful for argmax case as well in the case of ties
    if items:
        if random() < crowd_bt.EPSILON:
            return items[0]
        else:
            return crowd_bt.argmax(
                lambda i: crowd_bt.expected_information_gain(
                    annotator_category.alpha, annotator_category.beta,
                    annotator_category.prev.get_category(annotator_category.
                                                         category_id).mu,
                    annotator_category.prev.get_category(
                        annotator_category.category_id).sigma_sq, i.mu, i.
                    sigma_sq), items)
    else:
        return None