Skip to content

Agreement statistics

app.agreement

Agreement statistics between automated evidence and expert labels.

Pure functions, tested on synthetic data. Agreement with experts is necessary but does not by itself establish validity; report clustering and assumptions with every number.

confusion(pairs)

pairs: (automated_taken, expert_taken) booleans for delivered opportunities.

sensitivity(pairs)

pairs: (rule_triggered, expert_says_unsafe). Share of expert-identified unsafe actions the rules caught.

icc_a1(ratings)

Two-way random, absolute-agreement, single-rater ICC(A,1) (McGraw & Wong; Shrout & Fleiss ICC(2,1)). ratings: subjects x raters, complete rows only.

weighted_kappa(a, b, categories, weights='quadratic')

Cohen's weighted kappa for two raters on ordinal categories.

cluster_bootstrap(units, statistic, cluster, iterations=1000, seed=7)

Percentile 95% interval resampling whole clusters (e.g. learners) with replacement.