pytyche.calibrate.sbc

v2 calibration evaluator.

OracleConfig, oracle decision logic, and the calibrate function that bridges analysis output to calibration records.

calibrate consumes the v0.2 AnalysisResult SUMMARY surface: lean Comparison entries (point estimates and probabilities, no sample arrays) plus the RecommendationSummary decision-theoretic snapshot. Anything needing posterior samples goes through the posterior itself, not through calibrate.

Functions

calibrate(result, truth, oracle, ...)

Evaluate one analysis result against ground truth, returning a CalibrationRecord.

Classes

OracleConfig(ship_threshold, null_epsilon)

Oracle decision thresholds for calibration evaluation.

class pytyche.calibrate.sbc.OracleConfig(ship_threshold, null_epsilon)[source]

Bases: object

Oracle decision thresholds for calibration evaluation.

ship_threshold

effect > ship_threshold → SHIP.

null_epsilon

effect < -null_epsilon → STOP.

Both must be non-negative. No ordering constraint between them.

Parameters:
  • ship_threshold (float)

  • null_epsilon (float)

pytyche.calibrate.sbc.calibrate(result, truth, oracle, scenario_id, seed)[source]

Evaluate one analysis result against ground truth, returning a CalibrationRecord.

Pure function: no side effects, no MCMC, no data generation. Consumes the v0.2 AnalysisResult SUMMARY surface — point estimates and probabilities only, no posterior sample arrays.

Parameters:
  • result (AnalysisResult) – Summary analysis output from posterior.analyze().

  • truth (CalibrationTruth) – Ground truth for the simulated experiment.

  • oracle (OracleConfig) – Decision thresholds for correctness evaluation.

  • scenario_id (str) – Identifier for the simulation scenario.

  • seed (int) – Random seed for this run.

Return type:

CalibrationRecord

Returns:

A CalibrationRecord with all evaluation fields populated.

Raises:

ValueError – If any input validation check fails (fail-closed).