Model
The Majority voting model returns the most voted label among the $K$ labels, for each task:
\[\DeclareMathOperator*{\argmax}{argmax} \hat y_i = \argmax_{k\in[K]} \sum_{j\in [n_\texttt{worker}]} \unicode{x1D7D9}_{\{y_i^{(j)}=k\}}.\]CLI
With peerannot
in a terminal located in the directory of answers, the MV model can be used as follows.
peerannnot aggregate . --strategy MV --answers-file answers.json
Note that by default, if the answers are in a file names answers.json
the --answers-file
argument can be omitted.
API
Import the aggregation model in the current session
from peerannot.models import MV
Assuming the answers are in a dictionary names answers
then run:
mv = MV(answers, n_classes)
yhat = mv.get_answers()
Note that the majority voting aggregation produces hard labels (Dirac distributions).
API details: class models.MV
MV model class inherits from CrowdModel
__init__(answers, n_classes,**kwargs)
Parameters:
answers
:(dict) Dictionary of workers answers with format{ task0: {worker0: label, worker1: label}, task1: {worker1: label} }
n_classes
: (int) Number of possible classeskwargs
: (dict) Dictionary that can containpath_remove
to remove tasks identified from theWAUM
or another method.
compute_baseline()
For each given task, computes the number of votes for each label.
get_answers()
Returns the most voted class from the baseline
. In case of equalities, a random choice is applied.