Trust summary¶
The 9-tile traffic-light trust hero assembled from a populated
ProfilingResult. See the Evaluation & trust guide.
compute_trust_summary¶
compute_trust_summary ¶
compute_trust_summary(
profile: "ProfilingResult",
*,
drift_report: "PSIResult | None" = None,
leakage_report: "LeakageReport | None" = None,
fairness_report: "FairnessResult | dict[str, FairnessResult] | None" = None,
fitted: Any | None = None
) -> TrustSummary
Assemble the 9-tile Trust Summary hero.
Pure science layer — no I/O, no caching, no backend specifics.
Tiles whose underlying artefact is missing are graded "yellow"
with a subtext explaining what's missing, so the Explain hero
degrades gracefully on partial profiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
'ProfilingResult'
|
The :class: |
required |
drift_report
|
'PSIResult | None'
|
Optional :class: |
None
|
leakage_report
|
'LeakageReport | None'
|
Optional :class: |
None
|
fairness_report
|
'FairnessResult | dict[str, FairnessResult] | None'
|
Optional :class: |
None
|
fitted
|
Any | None
|
Reserved for tiles that need the live model (none currently — every tile reads from the persisted profile). Accepted for forward compatibility with the §I3 spec; ignored today. |
None
|
Returns:
| Type | Description |
|---|---|
TrustSummary
|
Frozen 9-tile container in :data: |
TrustSummary¶
TrustSummary
dataclass
¶
TrustSummary(
tiles: list[TrustTile],
overall_grade: TrustBadge,
headline: str,
schema_version: int = TRUST_SCHEMA_VERSION,
)
The 9-tile Trust Summary hero assembled for one experiment.
Attributes:
| Name | Type | Description |
|---|---|---|
tiles |
list[TrustTile]
|
Exactly 9 :class: |
overall_grade |
TrustBadge
|
Worst-of-tiles grade (green / yellow / red). A single red tile pulls the headline to red; a single yellow tile pulls it to yellow. This matches how analysts read the hero — "anything that's red, I have to defend". |
headline |
str
|
One-line plain-English narrative summarising the hero. Template-based today (e.g. "Trust score: yellow — 5 green, 3 yellow, 1 red"); future revisions may swap in an LLM narration without changing the schema. |
schema_version |
int
|
:data: |
TrustTile¶
TrustTile
dataclass
¶
TrustTile(
key: TrustTileKey,
label: str,
value: float | int | str,
badge: TrustBadge,
subtext: str,
details: dict[str, Any] = dict(),
)
One grading for one Trust Summary surface.
Attributes:
| Name | Type | Description |
|---|---|---|
key |
TrustTileKey
|
Stable machine identifier — one of the nine values in
:data: |
label |
str
|
Human-readable tile title (e.g. |
value |
float | int | str
|
Headline scalar for the tile. |
badge |
TrustBadge
|
Traffic-light grade. Threshold logic lives in
:mod: |
subtext |
str
|
One-line plain-English explanation — what the value means and
where to dig deeper. Surfaced under the tile in the hero
block and as the tooltip in the compact |
details |
dict[str, Any]
|
Optional small dict for extra context that the UI can render
on hover (e.g. |
Tile keys & thresholds¶
The canonical tile ordering and the traffic-light grading bands (both re-exported from the top level).
TRUST_TILE_KEYS
module-attribute
¶
TRUST_TILE_KEYS: tuple[TrustTileKey, ...] = (
"model_lift",
"calibration",
"drift",
"fairness",
"error_pocket",
"rules_hold_up",
"archetype_coverage",
"leakage_findings",
"stability",
)
Canonical ordering of the 9 tiles — matches the UI layout in
ui_concept.md §12.1. :func:parleml_mli.trust.compute_trust_summary
guarantees the returned tiles list is in this order so consumers
can index by position when convenient.
TRUST_THRESHOLDS
module-attribute
¶
TRUST_THRESHOLDS: dict[str, TrustThresholdBand] = {
"model_lift": {
"green": 1.5,
"yellow": 1.1,
"direction": "higher",
},
"calibration": {
"green": 0.05,
"yellow": 0.1,
"direction": "lower",
},
"drift": {
"green": 0.1,
"yellow": 0.25,
"direction": "lower",
},
"fairness": {
"green": 0.0,
"yellow": 2.0,
"direction": "count",
},
"error_pocket": {
"green": 0.0,
"yellow": 2.0,
"direction": "count",
},
"rules_hold_up": {
"green": 0.6,
"yellow": 0.3,
"direction": "higher",
},
"archetype_coverage": {
"green": 0.85,
"yellow": 0.6,
"direction": "higher",
},
"stability": {
"green": 0.7,
"yellow": 0.4,
"direction": "higher",
},
}
Per-tile numeric colour bands. leakage_findings is not present
because that tile uses :data:LEAKAGE_SEVERITY_GATE instead.