Skip to content

Coming from ppi_py

fewlabels.compat reproduces the mean estimation functions of ppi_py with the same signatures, defaults and numbers:

from fewlabels.compat import (
    classical_mean_ci,
    ppi_mean_ci,
    ppi_mean_pointestimate,
    ppi_mean_pval,
)

lower, upper = ppi_mean_ci(Y, Yhat, Yhat_unlabeled, alpha=0.1)

The test suite checks the agreement with ppi_py for random inputs, weights, one-sided alternatives and multivariate outcomes.

Two details to keep in mind:

  • ppi_py uses alpha=0.1 by default, while the native fewlabels functions use alpha=0.05.
  • With lam=None, ppi_py 0.2 returns a two-sided interval even when a one-sided alternative is requested. fewlabels.compat.ppi_mean_ci honours alternative.

Moving to the native interface

ppi_py fewlabels
ppi_mean_ci(Y, Yhat, Yhat_unlabeled) ppi_mean(y, preds_labeled, preds_unlabeled).ci
ppi_mean_pointestimate(...) ppi_mean(...).estimate
ppi_mean_pval(..., null=c) ppi_mean(...).pvalue(c)
classical_mean_ci(Y) classical_mean(y).ci

The native interface adds several annotators, clusters, a standard error and the effective number of labels. Its power tuning weight uses the separate prediction variances of the two samples rather than the pooled variance, which gives the same weight asymptotically.