![]() |
Quantum Fog
0.9.3
|


Public Member Functions | |
| def | __init__ (self, bnet, do_print=False, is_quantum=False) |
| def | get_unipot_list (self, node_list, num_cycles, warmup) |
| def | sample_node_given_markov_blanket (self, focus_node, annotated_story) |
Public Member Functions inherited from inference.InferenceEngine.InferenceEngine | |
| def | __init__ (self, bnet, do_print=False, is_quantum=False) |
Public Attributes | |
| bnet_ord_nodes | |
Public Attributes inherited from inference.InferenceEngine.InferenceEngine | |
| bnet | |
| do_print | |
| is_quantum | |
Additional Inherited Members | |
Static Public Member Functions inherited from inference.InferenceEngine.InferenceEngine | |
| def | print_annotated_story (annotated_story) |
An MCMC_Engine is an InferenceEngine that uses MCMC = Markov Chain Monte Carlo. The algo used here is described in the textbook: S. Russell and P. Norvig, "Artificial Intelligence, a Modern Approach, 3rd. Ed." (Prentice Hall, 2010) Section 14.5 "Approximate Inference in Bayesian Networks", page 537 Attributes ---------- bnet_ord_nodes : list[BayesNode] bnet : BayesNet do_print : bool is_quantum : bool
| def inference.MCMC_Engine.MCMC_Engine.__init__ | ( | self, | |
| bnet, | |||
do_print = False, |
|||
is_quantum = False |
|||
| ) |
Constructor Parameters ---------- bnet : BayesNet do_print : bool is_quantum : bool Returns -------
| def inference.MCMC_Engine.MCMC_Engine.get_unipot_list | ( | self, | |
| node_list, | |||
| num_cycles, | |||
| warmup | |||
| ) |
For each node in node_list, this method returns a uni-potential that
gives the probabilities for the states of that node. Obviously,
such a PD has the active states of the node as support.
Parameters
----------
node_list : list[BayesNode]
num_cycles : int
How many times we should cycle through all the nodes of the graph
warmup : int
How many cycles should we wait before we start collecting data
for the unipot list.
Returns
-------
list[DiscreteUniPot]
| def inference.MCMC_Engine.MCMC_Engine.sample_node_given_markov_blanket | ( | self, | |
| focus_node, | |||
| annotated_story | |||
| ) |
For fixed values of the states of the Markov Blanket of the focus node, sample a possible state of the focus node. The states of the Markov Blanket nodes are gleaned from 'annotated_story'. annotated_story is a dictionary mapping bnet_ord_nodes to their current state. A story (aka history or Feynman path or bnet instantiation) is a list of the current states of the nodes in the list bnet_ord_nodes. Parameters ---------- focus_node : BayesNode annotated_story : dict[BayesNode, int] Returns ------- (int, DiscreteUniPot)
1.8.11