mixle.substrate.eig_retrieve moduleΒΆ
Information-gain retrieval over substrate items.
Score substrate items by how much they would actually move a belief, not by how textually similar they are to the query.
retrieve() ranks by cosine/lexical similarity β a sound default, but many
similar-looking items can carry the same evidence (redundant), while a single differently-worded item can
be decisive. eig_retrieve() instead scores each candidate by the entropy it would actually remove from a
given BeliefState if assimilated, and greedily picks the highest-gain item
each round, updating the running belief before scoring what remains β so a second item redundant with the
first correctly scores near zero the next round. Experiment-design workflows can reuse the same greedy EIG
scorer; it is written once, here.
- eig_retrieve(substrate, belief, evidence_fn, *, k=8, kind=None, scope=None)[source]
Greedily pick up to
ksubstrate items by expected posterior-entropy reduction againstbelief.evidence_fn(item)turns a candidate item into whateverbelief.update(...)expects (e.g. a per-hypothesis log-likelihood vector for aCategoricalBelief). Each round, every remaining candidate is scored bycurrent_belief.entropy() - updated_belief.entropy(); the best-scoring item is taken, the running belief moves to its post-update state, and scoring repeats against the shrunk pool β so an item whose evidence is redundant with an already-picked item scores near zero on its next look, the direct fix for similarity retrieval pulling in near-duplicates. Items whoseevidence_fnraises (no usable evidence) are skipped, not fatal. Returned as aRetrieval(queryis a fixed marker, not a text query) so it composes with the sameto_context/by_kindsurface as cosine retrieval.