mixle.task.refine module¶
Diagnosis-directed correction versus blind structure search.
diagnose turns failing cases into a FaultReport naming a
structural element and a suggested fix. This module compares acting on that diagnosis with blind
search over the same edit space. Every candidate edge, whether diagnosed or blindly tried, is refit
from the same training data and verified against held-out data before acceptance. A candidate that
does not clear the held-out bar is recorded as a failed trial rather than silently kept.
The comparison is intentionally conservative: if diagnosis-directed correction does not reach the held-out target in fewer trials than blind search on the planted-fault benchmark, the recorded result shows that the diagnosis did not justify using the directed refinement path for that case.
- fit_independent_baseline(train_data)[source]
Fit an independent network with one marginal Gaussian per field.
- apply_edge(model, edge, train_data)[source]
Refit the named child factor as a linear-Gaussian conditional.
Every other factor is kept unchanged, so the returned model represents only the proposed edge edit.
- class EditTrial(edge, held_out_score, verified)[source]
Bases:
objectHeld-out result for one proposed graph edit.
- class SearchOutcome(trials, found_edge, final_model, history=<factory>)[source]
Bases:
objectFinal refinement state plus the verified edit-search history.
- diagnosis_directed_correction(model, train_data, failing_cases, held_out, *, background=None, target)[source]
Diagnose the fault from
failing_cases, apply only its suggested edge (trying both parent-child orientations of the named pair, sincediagnosereports an undirected co-anomaly), and verify held-out improvement before accepting – one trial if the diagnosis names the right pair and orientation, honestly more (or a refusal) if it does not.
- blind_structure_search(model, train_data, held_out, edit_space, *, target)[source]
Try candidate edges in order and accept only verified held-out gains.