mixle.reason.transport_edge module

Per-edge premise checks for cross-modal transport.

Every real modality edge should prove that a plain conditional transport is usable and calibrated on that edge’s own data before the edge is trusted in a belief graph. Calibration is checked against held-out truth for the edge rather than transferred from unrelated examples.

This module exposes a reusable per-edge check with two decisions:

  • premise fails: the edge should not be used for cross-modal purposes;

  • premise passes: the plain conditional transport may be composed as-is.

The check combines held-out coverage, conditional subgroup coverage, and interval sharpness. A low-power goodness-of-fit test or a trivially wide interval is not affirmative evidence.

class EdgeTransportVerdict(edge_name, status, receipt, coverage_rates=<factory>, coverage_lower_bounds=<factory>, relative_interval_widths=<factory>, subgroup_coverage_rates=<factory>, p_values=<factory>, reason='')[source]

Bases: object

Premise decision for one real modality edge, computed on that edge.

Parameters:
property usable: bool

Compatibility alias for an affirmative premise verdict.

class PremiseReceipt(edge_name, verifier, dataset_digest, metric, evaluated_at, status)[source]

Bases: object

Tamper-evident identity and outcome of one held-out edge check.

Parameters:
  • edge_name (str)

  • verifier (str)

  • dataset_digest (str)

  • metric (str)

  • evaluated_at (str)

  • status (PremiseStatus)

property passed: bool

Whether the premise supplied affirmative evidence for composition.

class PremiseStatus(*values)[source]

Bases: StrEnum

Evidence state for an edge premise.

coverage_consistent_with_nominal(covered_flags)[source]

(observed_rate, p_value) for a two-sided binomial test of coverage against 1 - ALPHA.

Return type:

tuple[float, float]

fit_conditional_transport(data, *, x_dim, y_dim, k=3, max_its=30, m_steps=80, lr=3e-3, seed=0, delta=1.0e-9, reuse_estep_ll=True)[source]

Fit p(cond | target) and return a sampler with sample_given.

Uses mixle.models.mixture_density.build_mdn() and NeuralConditionalDensity, fit through optimize(). Pass delta=None, reuse_estep_ll=False for an edge whose relationship needs the full iteration budget rather than early stopping. The seed is applied before module construction, to optimizer data order, and to the returned sampler. Exact bitwise replay can still depend on device-specific nondeterministic kernels.

Parameters:
marginal_coverage(sampler, x_test, y_test, *, n_draws=200)[source]

Return per-dimension credible-interval coverage flags.

Parameters:

n_draws (int)

verify_edge_transport(edge_name, sampler, x_test, y_test, *, n_draws=200)[source]

Check calibration and sharpness on aligned held-out edge data.

A passing result requires enough holdout rows, a one-sided confidence lower bound above the declared coverage floor, acceptable conditional subgroup coverage, and intervals narrower than a data-only baseline. Merely failing to reject a binomial null is never treated as evidence of calibration.

Parameters:
  • edge_name (str)

  • n_draws (int)

Return type:

EdgeTransportVerdict