pytyche.metrics¶
v2 metric dispatch registry.
Maps metric_id to model structure and extraction config. Single source of truth for metric → model routing in the v2 pipeline. No v1 dependency.
Functions
|
Look up metric config by canonical metric name. |
Classes
|
Maps a metric to its model, posterior extraction, and lift semantics. |
- class pytyche.metrics.MetricConfig(metric_id, metric_family, model_id, posterior_prefix, lift_unit, component_prefixes)[source]¶
Bases:
objectMaps a metric to its model, posterior extraction, and lift semantics.
- metric_id¶
Canonical metric name (e.g.
"conversion_rate").
- metric_family¶
Abstract metric family from the contract enum.
- model_id¶
Which PyMC model to fit.
- posterior_prefix¶
Variable name prefix in the posterior (e.g.
"p"forp_arm0).
- lift_unit¶
Unit for lift samples (
"pct"for relative,"dollar"for absolute).
- component_prefixes¶
Prefixes of decomposition effect deterministics in the posterior (e.g.
("frequency", "severity")maps tofrequency_effect_arm1_vs_arm0). Empty tuple for metrics without decomposition.
- Parameters:
metric_id (
str)metric_family (
MetricFamily)model_id (
Literal['binary','hurdle_lognormal'])posterior_prefix (
str)lift_unit (
str)component_prefixes (
tuple[str,...])