mixle.evolve.structure module¶
Structural genotype for evolutionary structure search — a model’s compositional tree + a distance on it.
Grammar/structure induction is not open research: it is genetic programming over structures (Koza 1992) with a
tree-edit genotype distance (Zhang & Shasha 1989) and selection by fitness. This module supplies the genotype
(model_signature) and the distance (structural_distance); the Mutate
operator supplies the mutations and the Population + verify gate supply selection.
A signature is a nested (type_label, [child_signatures]) tree — a mixture recurses into its .components,
a leaf is childless. The distance is an (unordered) tree-edit distance with greedy child matching: exact relabel
cost plus insert/delete of unmatched subtrees, normalized to [0, 1]. Greedy matching is a standard, adequate
approximation for the shallow trees model structures produce.
- model_signature(model)[source]
The compositional structure of
modelas a(type_label, [child signatures])tree.
- tree_edit_distance(a, b)[source]
Unordered tree-edit distance: relabel cost (0/1) + greedy min-cost matching of children, with unmatched subtrees fully inserted/deleted. Exact for identical trees; a standard greedy approximation otherwise.