mixle.task.discrepancy_invention_loop module¶
L5: the discrepancy -> invention loop – wiring epistemic discrepancy into structural invention.
The full chain named by the roadmap item, end to end:
discrepancy_report(champion, held_out) – 1. is the fitted champion’s predictive off? capacity ladder + ceiling_report(…) – 2. “tune it” (same family, needs more capacity/data)
vs. “the structure CLASS is exhausted” (invention trigger): a capacity ladder of same-family refits is fit and, unlike a bare
ceiling_reportcall, its trend is read – meaningful gain from more capacity means “tune it”, a plateau below target means ceiling-bound.
- propose_structure(candidates, …) – 3. search the composition grammar for a genuinely richer
structure (only reached when ceiling-bound).
- mixle.epistemic.loop.step(…, action_space=…) – 4. EIG picks the cheapest probe that would
distinguish the champion from the surviving proposals.
challenger_beats_champion(…) – 5. the same anti-regression gate L1/L4/L6 reuse. EpistemicJournal – 6. every step above is appended as a DecisionRecord with
a human-readable rationale; the ordered rationale list is the replayable reasoning chain.
- design_prior.rank_design_families(…) – 7. novelty of an accepted proposal, scored as surprise
relative to the design prior’s expectation for that structural family (
achieved - expected, or+infwhen the family has never been tried).
Every piece above is an EXISTING module (mixle.epistemic.discrepancy/loop/journal,
mixle.task.imagine, mixle.task.design_prior, mixle.evolve.verify); this module adds
no new core math, only the orchestration that chains them into one auditable loop.
- class InventionResult(verdict, discrepancy, ceiling, ceiling_bound, capacity_ladder_scores, imagine, novelty_scores=<factory>, probe_action=None, probe_eig=None, gate_verdict=None, adopted_structure=None, journal=<factory>)[source]
Bases:
objectThe full outcome of one discrepancy -> invention loop run, with its replayable journal.
- default_probe_action_space(data, *, n_probes=5)[source]
A default set of candidate probe locations: quantiles of
data’s own range.Querying near a quantile of the already-observed data is the natural default “where would the next observation land” grid when the caller has no domain-specific probe design of their own.
- default_probe_simulate_fn(hypothesis, action, rng, *, window)[source]
Simulate “if we probed near
action, what wouldhypothesispredict we’d observe?”Rejection-samples from
hypothesis.payload(a fitted distribution) until a draw lands withinwindowofaction; falls back toactionitself (an honest degraded value, not a crash) if the budget is exhausted – e.g. a hypothesis that assigns near-zero mass to that region, which is itself exactly the kind of information a distinguishing probe should surface.- Parameters:
hypothesis (Hypothesis)
action (float)
rng (RandomState)
window (float)
- Return type:
- reconstruct_reasoning_chain(journal)[source]
The ordered list of every stage’s rationale – the human-readable replay of the full chain.
- run_discrepancy_invention_loop(champion_fit, train, held_out, target, candidates, *, objective, tuning_variants=(), plateau_tol=0.15, design=None, probe_action_space=None, probe_window=None, probe_reweight_n=20, seed=0)[source]
The end-to-end L5 loop: discrepancy receipt -> ceiling verdict -> proposal -> EIG probe -> gate -> journal.
champion_fitfits an instance of the CURRENT structural family;tuning_variantsare other fits within that SAME family (more capacity, different regularization, more data, …) used to read the capacity ladder’s trend.candidatesis the composition-grammar search space handed topropose_structure(), only consulted when the ladder is ceiling-bound.designis the persistent design prior (mixle.task.design_prior) an adopted structure’s family gets recorded into; a fresh, empty one is used if omitted. Every stage is appended to the returned journal with a plain-Englishrationale–journal.records(orreconstruct_reasoning_chain()) is the full, ordered, replayable audit trail.
- score_design_prior_surprise(name, achieved_score, design)[source]
Novelty of an accepted structural family, as design-prior surprise:
achieved - expected.expectedismixle.task.design_prior.rank_design_families()’s recorded mean quality forname’s family, or-inf(viarank_design_families’s owndefault_scoreconvention) if the family has never been tried before – which makes it maximally surprising by construction:+infrather than an arbitrary finite number, so “genuinely never-seen-before” is never confused with “merely better than a middling prior.”