Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

DiscreteSearch

Search is an alternative to exact discrete inference, which can be exponential. DiscreteSearch enumerates the best assignments of a discrete model in increasing error order, returning each complete assignment and its negative-log error as a DiscreteSearchSolution.

Open In Colab

Constructing the search problem

FromFactorGraph() eliminates a graph into the internal search representation. The explicit ordering controls that preprocessing; setting buildJunctionTree=True selects the junction-tree construction path.

Ranked solutions

run(K) returns at most K DiscreteSearchSolution objects. assignment is a DiscreteValues map and error is the additive objective; lower error means higher probability. lowerBound() reports the search object’s current lower bound.

Alternative inputs

The constructor also accepts an existing DiscreteEliminationTree, DiscreteJunctionTree, DiscreteBayesNet, or DiscreteBayesTree. Reuse one of those when elimination has already been performed. Search is useful for N-best hypotheses; use DiscreteFactorGraph.optimize() when only the single MPE solution is needed.

Source

DiscreteSearch.h

AI assistance caveat

AI was used to help draft this documentation, and inaccuracies could be present.