Expand description
Probabilistic abduction — Bayesian scoring and ranking of competing hypotheses.
Among the hypotheses that could explain an observation, the best is the most probable a
posteriori: P(h | obs) ∝ P(h) · P(obs | h) (prior × likelihood), normalised over the
candidates. Zero-heap (caller-supplied out).
Structs§
- Hypothesis
- A candidate abductive hypothesis: its id, Bayesian
priorP(h), and thelikelihoodit assigns to the observationP(obs | h). Both in[0, ∞)(typically[0,1]).
Functions§
- bayesian_
posteriors - Posteriors
P(h | obs) ∝ prior·likelihood, normalised overhyps, written intoout(parallel tohyps). Returns the evidenceP(obs) = Σ prior·likelihood(the normaliser); if it is ~0 (no hypothesis explains the observation)outis filled with zeros and0.0is returned. Refuses on a length mismatch by returning0.0without writing. - best_
hypothesis - The maximum-a-posteriori hypothesis id — the one with the greatest
prior·likelihood(argmax of the posterior; normalisation is monotone so it needs no division).Noneifhypsis empty or carries no probability mass.