mixle.inference.planning module¶
Estimation planning and evidence-backed certificates.
Planning and certification are deliberately different. Model structure can suggest an estimator and an upper bound on what it could prove, but a class name or capability marker cannot prove that a particular fit is identified, converged, or globally optimal. A certificate therefore reports both the candidate guarantee and the guarantee established by checked conditions or explicit verification receipts.
- class Guarantee(*values)[source]
Bases:
IntEnumHow strong the solution to an estimation block is, as an ordered ladder (higher = stronger).
- property label: str
Return the enum name used in reports.
- class ProofObligation(check, required_for, description)[source]
Bases:
objectA condition that must be evidenced before a block may claim a guarantee.
- class VerificationReceipt(receipt_id, block, guarantee, checks, source, evidence, subject_hash='')[source]
Bases:
objectEvidence that named checks were performed for one estimation block.
Receipts are explicit audit inputs, not Boolean assertions.
evidencemust contain the measurements or result metadata supporting the checks.- Parameters:
- class BlockPlan(name, kind, method, guarantee, gradient, placement, reason, candidate_guarantee=None, proof_obligations=(), verified_checks=(), receipt_ids=(), verified_by='', unbound_receipt_ids=())[source]
Bases:
objectOne estimation block and the distinction between planned and verified strength.
- class EstimationCertificate(guarantee, blocks=<factory>, escape_tested=False)[source]
Bases:
objectThe auditable proof of how a model was (or would be) estimated: per-block plans + the aggregate.
guaranteeis the minimum over blocks.why_not_adamsummarizes where gradient optimization was used and why those blocks could not use a stronger closed-form or convex route.- property gradient_blocks: list[BlockPlan]
Return blocks that require gradient optimization.
- property closed_form_blocks: list[BlockPlan]
Return blocks with global or stronger guarantees.
- why_not_adam()[source]
The audit: which blocks needed gradient descent and why – everything else got a stronger method.
- Return type:
- class EstimationSchedule(passes=<factory>, latent=False)[source]
Bases:
objectThe block-coordinate schedule planner v2 produces (A3): ordered passes + the loop structure.
A fully-factorized model schedules one independent pass per block (no loop). A latent model schedules the EM loop explicitly: an E-step over the latent, then one M-step pass PER BLOCK per round – each M-step named with its own method, so the schedule shows exactly where the closed forms live inside the iteration (and which pass, if any, is the gradient block a pool would take).
- property per_round: list[SchedulePass]
Return schedule passes repeated inside each latent-variable round.
- property gradient_passes: list[SchedulePass]
Return schedule passes assigned to gradient optimization.
- class SchedulePass(order, kind, block, method, placement, repeat)[source]
Bases:
objectOne pass of the estimation schedule: what runs, on which block, how, where, and how often.
- certify(model, *, data=None, receipts=(), escape_tested=False, penalized=False)[source]
Return the
EstimationCertificatefor a fitted model (or distribution prototype).Model structure supplies only a candidate guarantee.
datais checked byverify_estimation_conditions(); additional optimizer evidence may be supplied as structuredreceipts. A bareescape_tested=Trueis rejected because a caller assertion is not verification evidence.Pass
penalized(a reason string, or True) when the fit optimized a penalized objective – soft constraints, conservation/PINN residual factors, potentials (E2). The optimum is then of the penalized surrogate, not the likelihood, so no block may claim more than STATIONARY however clean its own solver is: every stronger block is downgraded with the penalty named in its reason.
- receipt_subject(model)[source]
Return the subject identifier a
VerificationReceiptmust carry to be aboutmodel.A caller supplying optimizer evidence the library cannot produce itself – multi-start escape testing, a solver’s own convergence report – names the model it verified:
VerificationReceipt(..., subject_hash=receipt_subject(model))
Requiring this is the point (MXR-080-1877): before it, naming the right check strings was the whole test, so a receipt whose evidence read
{"trust": "me"}upgraded an arbitraryGaussianDistribution(999, 1)toGLOBAL_UNIQUE. Binding does not make forgery impossible – anyone holding the model can compute this – but it means a receipt cannot be written without the model, cannot be reused against a different one, and stops applying the moment the parameters change. What a reader gains is in the certificate:BlockPlan.verified_bynames who established each guarantee, so library-checked conditions no longer read identically to a caller’s assertion.
- verify_estimation_conditions(model, data)[source]
Check data-dependent proof obligations for supported analytic estimators.
Unsupported or iterative estimators produce no receipt rather than a guessed guarantee. The returned receipts can be passed to
certify().
- plan_estimation(model)[source]
Return a pre-fit plan whose guarantees remain explicitly unverified.
- Parameters:
model (Any)
- Return type:
EstimationCertificate
- schedule(model, *, escape_tested=False, receipts=())[source]
Plan the block-coordinate estimation schedule for
model(planner v2, A3).Built from the same block classification as
certify(): EM blocks make the schedule a loop (E-step + per-block M-steps, repeated until convergence); without a latent block every block is one independent pass. Gradient blocks appear as explicitgradientpasses with their pool placement, so the schedule is also the offload plan for the hybrid case.receiptsexists becauseescape_testedwas otherwise unusable in both directions (MXR-080-1905). It forwards tocertify(), which refusesescape_tested=Truewith “supply a VerificationReceipt” – and this function had no parameter through which to supply one, so the only non-default value raised an error naming a remedy the caller could not reach. Pass escape evidence here instead, bound to the model viareceipt_subject()(MXR-080-1877).