Expand description
Turning many raters’ labels into one answer: majority, plurality and weighted votes (exact), the Dawid–Skene EM model of rater confusion, Bradley–Terry strengths from pairwise comparisons, and the worker quality helpers that go with them (accuracy against gold labels, per-category precision / recall / F₁, confidence intervals for a proportion, gold-question screening).
Labels are category indices 0..n_categories; a LabelTable holds
them items × raters with None for a missing label. Votes and
accuracies are exact (Q); the two iterative estimators
(dawid_skene, bradley_terry) and the confidence intervals are
f64.
use symplex::stats::aggregation::{majority_vote, worker_accuracy};
use symplex::linprog::q;
let v = majority_vote(&[Some(2), Some(0), Some(2), None, Some(1)]);
assert_eq!((v.winner, v.counts), (Some(2), vec![1, 1, 2]));
let acc = worker_accuracy(&[Some(2), Some(0), Some(2), None, Some(1)], &[2, 0, 1, 1, 1])?;
assert_eq!((acc.correct, acc.answered, acc.accuracy), (3, 4, Some(q(3, 4))));Structs§
- Accuracy
- A worker’s accuracy against gold labels.
- Bradley
Terry - Bradley–Terry strengths.
- Bradley
Terry Opts - Options of
bradley_terry. - Category
Metrics - Precision, recall and F₁ of one category, over the answered items.
- Dawid
Skene - The Dawid–Skene estimates.
- Dawid
Skene Opts - Options of
dawid_skene. - Label
Table - Labels of
n_itemsitems byn_ratersraters (rows are items), each a category index belown_categoriesorNonewhen missing. - Pairwise
Outcome - One pairwise comparison: player
winnerbeat playerloser(both indices below the number of players). - Vote
- The outcome of a vote over category indices.
- Weighted
Vote - The outcome of a weighted vote.
Enums§
- Dawid
Skene Init - How the Dawid–Skene EM iteration is started.
- Interval
Method - Confidence-interval methods for a binomial proportion
(
statsmodels.stats.proportion.proportion_confint(method=…)).
Functions§
- bradley_
terry - Maximum-likelihood Bradley–Terry strengths from a wins matrix
(
wins[i][j]= timesibeatj) by the MM algorithm of Hunter (2004, Ann. Statist. 32, 384–406): - category_
metrics - Per-category precision, recall and F₁ of a worker against gold labels, over the items the worker answered.
- dawid_
skene - The Dawid–Skene EM estimate of true classes, rater confusion matrices
and class prevalences (Dawid & Skene 1979, Applied Statistics 28,
20–28). Iterates, from the
DawidSkeneInitposteriorsT_ij: - dawid_
skene_ counts - The Dawid–Skene model from items × raters × categories counts
n_ikl(how many times raterkgave itemithe labell; the general form of Dawid & Skene 1979 where a rater may label an item several times). Seedawid_skene. - gold_
screening - Pass / fail of every rater on the gold items:
Some(true)when the rater’s accuracy on the gold items answered is at leastthreshold,Nonefor a rater who answered no gold item.gold[i]is the gold label of itemiorNonefor a non-gold item. - majority_
vote - The category chosen by most raters (missing labels are ignored; the count vector runs to the largest label seen).
- majority_
votes - The majority vote of every item of a
LabelTable(counts have lengthn_categories). - plurality
- A plurality vote with a quorum: the top category wins only if it has
at least
thresholdof the votes cast (thresholdin[0, 1]). - proportion_
interval - A two-sided confidence interval for the success probability behind
successesout oftrials, at levelconfidence(e.g.0.95). Withp̂ = k/n,α = 1 − confidenceandz = Φ⁻¹(1 − α/2): - weighted_
vote - A vote where rater
k’s label countsweights[k](non-negative, exact). - wins_
matrix - A wins matrix (
wins[i][j]= timesibeatj) from a list ofPairwiseOutcomes amongnplayers — the input ofbradley_terry. - worker_
accuracy - A worker’s accuracy on items with gold labels (missing labels are not counted as answered).