mixle.scorecard module

System-level scorecard for held-out question sets.

Named SystemScorecard (not Scorecard) to avoid colliding with mixle.task.scorecard.Scorecard – a different, narrower comparison (one student solution vs its teacher on a task); this one evaluates a whole System (teacher, captured cache, degraded modes, budget, all of it) end to end.

class SystemScorecard(quality, calibration, realized_cost, grounded_fraction, n)[source]

Bases: object

One evaluation of a System against a fixed held-out question set.

Parameters:
to_dict()[source]

Serialize the scorecard into primitive fields.

Return type:

dict[str, Any]

evaluate(system, question_set, *, scorer=None)[source]

Evaluate system over a fixed [(query, expected_answer), ...] set.

  • quality – fraction of questions scorer judges correct (default: case-insensitive substring match of expected in the reply).

  • grounded_fraction – fraction answered WITHOUT a degraded mode (teacher or captured, not a store-only fallback / refusal / failure): the fraction of answers you can actually trust came from a real answer path, not a fault-boundary guess.

  • realized_cost – total spend units (total_units()) across the set.

  • calibration – a coarse proxy (currently equal to quality) until answer carries a real per-answer confidence to calibrate against; extend THIS function, not call sites, once that lands.

Parameters:
Return type:

SystemScorecard

class RegressionReport(regressed, reasons=<factory>)[source]

Bases: object

Whether current is worse than baseline on any tracked axis, and exactly why.

Parameters:
detect_regression(baseline, current, *, tolerance=1e-9)[source]

Compare two scorecards from the SAME held-out set across improve-rounds.

Never silently accepts a round that answers worse, less groundedly, or for more cost than the round before it – each tracked axis that got worse (beyond tolerance) is named in reasons.

Parameters:
  • baseline (SystemScorecard)

  • current (SystemScorecard)

  • tolerance (float)

Return type:

RegressionReport