Skip to content

Theory

This page derives the formulas used in fewlabels. See References for the original papers.

The estimator

Let \(Y\) be the outcome and \(f \in \mathbb{R}^K\) the predictions of \(K\) annotators. The labelled sample has \(n\) cases with \((Y_i, f_i)\); the unlabelled sample has \(N\) cases with \(\tilde f_j\) only. For a fixed weight vector \(\lambda\),

\[ \hat\theta_\lambda = \bar Y_n - \lambda^\top\bigl(\bar f_n - \bar{\tilde f}_N\bigr). \]

Both prediction means estimate \(E[f]\), so their difference has expectation zero and \(\hat\theta_\lambda\) is unbiased for \(\theta = E[Y]\) for every \(\lambda\). This is why the interval stays valid when the model is biased or poor.

Variance and optimal weights

Write \(V_L\) and \(C_L\) for (co)variances of means on the labelled sample and \(V_U\) on the unlabelled sample. Since the samples are independent,

\[ V(\lambda) = V_L(Y) - 2\lambda^\top C_L(f, Y) + \lambda^\top\bigl(V_L(f) + V_U(f)\bigr)\lambda , \]

a quadratic function minimised by

\[ \lambda^\ast = \bigl(V_L(f) + V_U(f)\bigr)^{-1} C_L(f, Y). \]

For one annotator and independent cases, \(\lambda^\ast = \operatorname{Cov}(Y, f) / \{(1 + n/N)\operatorname{Var}(f)\}\), the power tuning of PPI++. The interval is \(\hat\theta \pm z_{1-\alpha/2}\sqrt{V(\hat\lambda)}\). Estimating \(\lambda\) on the same data changes the estimator by a term of smaller order than its standard error, so the interval is asymptotically valid.

Planning

Substituting \(\lambda^\ast\) for independent cases gives

\[ V(\lambda^\ast) = \frac{\sigma_Y^2}{n}\left(1 - \frac{R^2}{1 + n/N}\right), \qquad R^2 = \frac{C(f, Y)^\top \Sigma_f^{-1} C(f, Y)}{\sigma_Y^2}, \]

where \(R^2\) is the population coefficient of determination of the regression of \(Y\) on \(f\). For a binary outcome with prevalence \(p\) and a binary prediction with sensitivity \(s_e\) and specificity \(s_p\), \(q = p\,s_e + (1-p)(1-s_p)\) and

\[ R^2 = \frac{(p\,s_e - p\,q)^2}{p(1-p)\,q(1-q)} . \]

The number of labels for a margin of error \(w\) is the smallest \(n\) with \(z\sqrt{V(\lambda^\ast)} \le w\), found by bisection. Power for an effect \(\delta\) uses the normal approximation \(1 - \Phi(z_{1-\alpha/2} - \delta/\sqrt{V}) + \Phi(-z_{1-\alpha/2} - \delta/\sqrt{V})\).

Clusters

With clusters \(g = 1, \dots, G\) the covariance of a mean of \(z\) is estimated by

\[ \frac{G}{G-1}\,\frac{1}{n^2}\sum_{g} T_g T_g^\top, \qquad T_g = \sum_{i \in g}(z_i - \bar z), \]

which equals the usual estimate when every case is its own cluster. The same formulas for \(\lambda^\ast\) and \(V(\lambda)\) then apply.

Known selection probabilities

If case \(i\) of a population of \(N\) is labelled with known probability \(\pi_i\), independently of the others, then with labelling indicator \(\xi_i\)

\[ \hat\theta_\lambda = \frac{1}{N}\sum_{i=1}^{N} \psi_i(\lambda), \qquad \psi_i(\lambda) = \lambda^\top f_i + \frac{\xi_i}{\pi_i}\bigl(Y_i - \lambda^\top f_i\bigr), \]

is unbiased because \(E[\xi_i/\pi_i] = 1\). Writing \(\psi_i = A_i + B_i^\top\lambda\) with \(A_i = \xi_i Y_i/\pi_i\) and \(B_i = f_i(1 - \xi_i/\pi_i)\), the variance is quadratic in \(\lambda\) with minimiser \(\lambda^\ast = -\operatorname{Var}(B)^{-1}\operatorname{Cov}(B, A)\). The variance is smallest when \(\pi_i\) is proportional to the expected absolute residual, which motivates inclusion_probabilities.

Sensitivity to unknown selection

Write the estimate with \(\lambda = 1\) as the mean prediction over all cases plus a weighted mean of labelled residuals \(r_i = Y_i - f_i\) with weights \(w_i = 1/\pi_i\). Under the marginal sensitivity model the true inverse probability lies in

\[ 1 + \frac{1/\pi_i - 1}{\Gamma} \;\le\; w_i^\ast \;\le\; 1 + \Gamma\,(1/\pi_i - 1). \]

The extreme values of the weighted mean \(\sum w_i r_i / \sum w_i\) over this box are attained at a vertex where the high weights go to the largest (for the maximum) or smallest (for the minimum) residuals, so they are found by scanning the sorted residuals. A percentile bootstrap of the two extremes gives an interval that covers the identified set.

Several annotators

The effective number of independent annotators reported by annotator_report is the classical \(K_{\text{eff}} = K / \bigl(1 + (K-1)\bar\rho\bigr)\), where \(\bar\rho\) is the mean pairwise correlation of the annotators' errors.