Foresight.Evals.Labeling.Kappa (Foresight v0.1.0)

Copy Markdown View Source

D2: Cohen's kappa between human and llm calibration grades — the trust gate on the bulk judge. If the judge doesn't agree well enough with the human gold slice, its labels can't be trusted to train D2 against (optimizing to a machine's biases is the Track-B gaming trap), so the pipeline gates the full labeling run on this number.

Grades are the ordinal 0..3 relevance scale, so :quadratic weighting (the default) penalizes an off-by-3 disagreement 9x more than off-by-1 — the right model for graded relevance. :linear and :unweighted are available for comparison. Pure math.

Summary

Types

pair()

@type pair() :: {non_neg_integer(), non_neg_integer()}

result()

@type result() :: %{
  kappa: float() | nil,
  n: non_neg_integer(),
  weighting: weighting()
}

weighting()

@type weighting() :: :quadratic | :linear | :unweighted

Functions

weighted(pairs, opts \\ [])

@spec weighted(
  [pair()],
  keyword()
) :: result()