jpt.inference.mpe

Classes

MPEState

BnBNode

BnBSolution

MPESolver

Solver for k-MPE inference about n independent variables

Module Contents

class jpt.inference.mpe.MPEState(assignment: jpt.variables.VariableMap)
assignment
latest_variable = None
copy()
assign(variable: Variable or str, value: Any) MPEState
__repr__()
class jpt.inference.mpe.BnBNode(solver, state, actual_cost)
solver: MPESolver
old_state: MPEState
variable: jpt.variables.Variable = None
values: Iterator[Any]
actual_cost
step_cost = 0
state: MPEState = None
_generate_next()
pop()
property cost
property free_variables
class jpt.inference.mpe.BnBSolution(state: MPEState, cost: float)
state
cost
class jpt.inference.mpe.MPESolver(distributions: jpt.variables.VariableMap, likelihood_divisor: float = None)

Solver for k-MPE inference about n independent variables

This algorithm iteratively constructs all k most probable explanations in descending order by performing a branch-and-bound search in the space of atomic areas of the respective distributions. In constrast to classic BnB search, we do not throw away the pruned states but save them in a priority queue, where we can continue the search for the subsequent 2nd, 3rd, …, k-th best solution.

distributions: jpt.variables.VariableMap
domains
constraints
lb
likelihood(solution: BnBSolution)
is_goal_state(state: MPEState) bool
variable_order(state: MPEState = None) Iterator[jpt.variables.Variable]
Parameters:

state – The state to start from

Returns:

An iterator over free variables for a state sorted by number of different possible states (lowest amount of values first).

solve(k: int = 0) Iterator[List[jpt.variables.ValueAssignment]]

Generate k MPE states with decreasing probability.

Returns: