pytyche.analysis.evaluate_against_truth¶
- pytyche.analysis.evaluate_against_truth(posterior, tree, truth)[source]¶
Evaluate the posterior + tree policy against ground truth.
Sim-mode only: generators pair observed data with a
CalibrationTruth; real-data mode has no truth and raisesRuntimeError.- Parameters:
posterior (
HurdleBCFResult|ContinuousBCFResult|BinaryBCFResult) – One of the three posterior result types, carrying observed data (raises otherwise).tree (
PolicyTreeResult) – The fitted policy whose assignments are evaluated.truth (
CalibrationTruth|None) – Ground truth for the simulated experiment, orNonein real-data mode.
- Return type:
- Returns:
TruthComparisonwith all six metrics populated.- Raises:
RuntimeError – When truth is
None(real-data mode — nothing to evaluate against).ValueError – When
posterior.observedisNone, when the truth lacks the K-appropriate contrast or potential-outcome fields, or when the truth shapes do not match the posterior.