Skip to main content

Module calibration

Module calibration 

Source
Expand description

Calibration parameter tables for decision models (System One P0.3/P2.2).

One row holds the post-hoc calibration parameters for a single decision primitive (noul/choice/score) of one decision schema on one model, keyed by the (schema_id, model_id, calib_version) version triple:

  • per-primitive temperature,
  • null-state (content-free) bias vector,
  • optional Dirichlet-calibration params for high-cardinality choice,
  • conformal quantiles per primitive — score uses ordinal contiguous-interval params, noul/choice use APS/RAPS-style quantiles.

Rows are append-only: a calibration re-fit mints a NEW calib_version row and never updates in place, so every past fit stays queryable and serving can pin an exact triple.

Structs§

CalibrationParams
One calibration parameter row.
CalibrationStore
Calibration parameter store over any StorageBackend: the writer API for the P2.2 re-fit loop and the reader API for serving.
ConformalQuantile
One coverage level → nonconformity quantile (APS/RAPS-style).
DirichletParams
Dirichlet-calibration parameters (Kull et al. 2019) for high-cardinality choice questions, where scalar temperature underfits: calibrated log-probs are W · ln(p) + b with weights row-major K×K and bias of length K.
OrdinalInterval
One coverage level → ordinal contiguous interval half-widths, in level units, applied around the predicted level (min-CPS / RPS-based nonconformity for the score primitive).
VersionTriple
The (schema, model, calib) version triple keying every calibration row.

Enums§

ConformalParams
Conformal parameters for one primitive. Score questions are ordinal, so their prediction sets are contiguous intervals; noul/choice use APS/RAPS-style quantiles.
DecisionPrimitive
Decision primitive a calibration row applies to (jev-1 profile superset).

Constants§

CALIBRATION_TABLE
Calibration parameter table name.

Functions§

calibration_params_schema
Arrow schema of the calibration_params table. Vector/composite params are stored as JSON in nullable VARCHAR columns (the crate’s existing convention for composite values, queryable via DuckDB JSON functions).
mint_calib_version
Mint a new calibration version id. Re-fits call this (or supply their own) and insert a new row; existing rows are never mutated.
params_from_row
Decode one calibration row from a query result batch.
params_to_record_batch
Build the one-row RecordBatch for a calibration insert.