def majority_vote(labels, weight=None):
    'Perform majority vote to determine the true label from\n    multiple noisy oracles.\n\n    Parameters\n    ----------\n    labels: list\n        A list with length=k, which contains the labels provided by\n        k noisy oracles.\n\n    weight: list, optional (default=None)\n        The weights of each oracle. It should have the same length with\n        labels.\n\n    Returns\n    -------\n    vote_count: int\n        The number of votes.\n\n    vote_result: object\n        The label of the selected_instance, produced by majority voting\n        of the selected oracles.\n    '
    oracle_weight = (np.ones(len(labels)) if (weight is None) else weight)
    assert (len(labels) == len(oracle_weight))
    vote_result = collections.Counter(labels)
    most_votes = vote_result.most_common(n=1)
    return (most_votes[0][1], most_votes[0][0])
Perform majority vote to determine the true label from
multiple noisy oracles.

Parameters
----------
labels: list
    A list with length=k, which contains the labels provided by
    k noisy oracles.

weight: list, optional (default=None)
    The weights of each oracle. It should have the same length with
    labels.

Returns
-------
vote_count: int
    The number of votes.

vote_result: object
    The label of the selected_instance, produced by majority voting
    of the selected oracles.
def majority_vote(labels, weight=None):
    'Perform majority vote to determine the true label from\n    multiple noisy oracles.\n\n    Parameters\n    ----------\n    labels: list\n        A list with length=k, which contains the labels provided by\n        k noisy oracles.\n\n    weight: list, optional (default=None)\n        The weights of each oracle. It should have the same length with\n        labels.\n\n    Returns\n    -------\n    vote_count: int\n        The number of votes.\n\n    vote_result: object\n        The label of the selected_instance, produced by majority voting\n        of the selected oracles.\n    '
    oracle_weight = (np.ones(len(labels)) if (weight is None) else weight)
    assert (len(labels) == len(oracle_weight))
    vote_result = collections.Counter(labels)
    most_votes = vote_result.most_common(n=1)
    return (most_votes[0][1], most_votes[0][0])