topos.evaluation.policies.calibration

Policy calibration — central hub for evaluation gates and scoring constants.

Edit the module-level singletons (SIMPLE, COMPOSABLE, SECURE, COVERAGE, CLONE) and SCORE_FLOORS when updating from experimental data. All policy translators import from this module; nothing else should define pass/fail or normalization numbers.

Sections

Raw-metric gates — drive ScoredDecision.achieved (AND semantics). Each Φᵢ compares probe values against these fields; they are the decisive pass/fail criteria for the three quality generators in Ω.

Normalization caps/scales — map raw metrics to [0, 1] quality scores for reporting and multi-file aggregation. They do not gate achieved.

Score floors — alternate path via meet_satisfied() and multi-file CharacteristicMorphism meets. Live Φᵢ translators do not use these for achieved.

Auxiliary — clone detection and declaration-coverage defaults (outside Ω).

Calibration provenance: PyPI corpus ECDF calibration (June 2026). See topos-leaderboard/CALIBRATION_REPORT.md and calibration.json.

class topos.evaluation.policies.calibration.SimplePolicyThresholds(max_cyclomatic=15.0, max_function_complexity=10.0, min_entropy=0.2, max_entropy=0.8, max_cyclomatic_cap=40.0, max_function_complexity_cap=20.0, entropy_ideal=0.5)[source]

Bases: object

Φ_SIMPLE gates and normalization.

max_cyclomatic = 15.0
max_function_complexity = 10.0
min_entropy = 0.2
max_entropy = 0.8
max_cyclomatic_cap = 40.0
max_function_complexity_cap = 20.0
entropy_ideal = 0.5
class topos.evaluation.policies.calibration.ComposablePolicyThresholds(instability_low=0.3, instability_high=0.7, max_fan_in=15.0, max_fan_out=15.0, max_fan_in_cap=40.0, max_fan_out_cap=40.0)[source]

Bases: object

Φ_COMPOSABLE gates and normalization.

instability_low = 0.3
instability_high = 0.7
max_fan_in = 15.0
max_fan_out = 15.0
max_fan_in_cap = 40.0
max_fan_out_cap = 40.0
class topos.evaluation.policies.calibration.SecurePolicyThresholds(max_dangerous_calls=0.0, max_taint_flows=0.0, danger_scale=3.0, taint_scale=3.0)[source]

Bases: object

Φ_SECURE gates and normalization.

max_dangerous_calls = 0.0
max_taint_flows = 0.0
danger_scale = 3.0
taint_scale = 3.0
class topos.evaluation.policies.calibration.CoveragePolicyThresholds(declaration_recall=0.5, strong_offset=0.25, partial_factor=0.5)[source]

Bases: object

Structural test-coverage policy (outside Ω).

declaration_recall = 0.5
strong_offset = 0.25
partial_factor = 0.5
class topos.evaluation.policies.calibration.ClonePolicyThresholds(max_normalized_distance=0.1)[source]

Bases: object

Pairwise clone detection (outside Ω).

max_normalized_distance = 0.1