Quantum Fog  0.9.3
Public Member Functions | Public Attributes | List of all members
PBNT.Inference.JunctionTreeEngine Class Reference
Inheritance diagram for PBNT.Inference.JunctionTreeEngine:
Inheritance graph
[legend]
Collaboration diagram for PBNT.Inference.JunctionTreeEngine:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, bnet)
 
def marginal (self, query)
 0 = no change, 1 = update, 2 = retract isChange = 0 changedNodes = [] for (node, value) in zip(nodes, values): Make sure node has actually changed if not self.evidence[node.index] == value: changedNodes += node Check if node is retracted if not self.evidence[node.index] == -1: isChange = 2 break else: isChange = 1 More...
 
def global_propagation (self)
 
def collect_evidence (self, prevClique, currentClique, sepset, isStart)
 
def distribute_evidence (self, clique)
 
def pass_message (self, fromClique, toClique, sepset)
 
def project (self, clique, sepset)
 
def absorb (self, clique, sepset, oldPotential)
 
def build_join_tree (self, triangulatedGraph)
 
def create_sepset_priority_queue (self, cliques)
 
- Public Member Functions inherited from PBNT.Inference.InferenceEngine
def __init__ (self, bnet)
 
def marginal (self)
 

Public Attributes

 joinTree
 
- Public Attributes inherited from PBNT.Inference.InferenceEngine
 bnet
 
 evidence
 

Detailed Description

This implementation of the Junction Tree inference algorithm comes from "Belief Networks: A Procedural Guide" By Cecil Huang an Adnan Darwiche (1996).  See also Kevin Murhpy's PhD Dissertation.  Roughly this algorithm decomposes the given bayes net to a moral graph, triangulates the moral graph, and collects it into cliques and joins the cliques into a join tree.  The marginal is then computed from the constructed join tree.

Member Function Documentation

def PBNT.Inference.JunctionTreeEngine.absorb (   self,
  clique,
  sepset,
  oldPotential 
)
absorb divides the sepset's potential by the old potential.  The result is multiplied by the clique's potential.  Please see c. Huang and A. Darwiche 96.  As with project, this could be optimized by finding the best set of axes to iterate over (either the sepsets, or the clique's axes that are not in the sepset).  The best solution would be to define a multiplication operation on a Potential that hides the details.
def PBNT.Inference.JunctionTreeEngine.create_sepset_priority_queue (   self,
  cliques 
)
Create a sepset (with a unique id) for every unique pair of cliques, and insert it into a priority queue.
def PBNT.Inference.JunctionTreeEngine.marginal (   self,
  query 
)

0 = no change, 1 = update, 2 = retract isChange = 0 changedNodes = [] for (node, value) in zip(nodes, values): Make sure node has actually changed if not self.evidence[node.index] == value: changedNodes += node Check if node is retracted if not self.evidence[node.index] == -1: isChange = 2 break else: isChange = 1

Just to avoid import errors assert(1 == 1) Do a global update for node in changedNodes: Just to avoid import errors assert(1 == 1) Update potential X and its likelihood with the new observation Then do global propagation (if only 1 cluster affected only have to distribute evidence. elif isChange == 2: Do a global retraction: Encode the new likelihoods (and do observation entry), Reinitialize the join tree, do a Global propagation. Just to avoid import errors assert(1 == 1)

def PBNT.Inference.JunctionTreeEngine.project (   self,
  clique,
  sepset 
)
We want to project from the clique to the sepset.  We do this by marginalizing the clique potential into the sepset potential.

The documentation for this class was generated from the following file: