Quantum Fog  0.9.3
Public Member Functions | Public Attributes | Properties | Private Attributes | List of all members
nodes.BayesNode.BayesNode Class Reference
Inheritance diagram for nodes.BayesNode.BayesNode:
Inheritance graph
[legend]
Collaboration diagram for nodes.BayesNode.BayesNode:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, id_num, name="blank", size=2)
 
def set_potential (self, pot)
 
def resize (self, size)
 
def set_state_name (self, position, name)
 
def st_name_index (self, st_name)
 
def forget_all_evidence (self)
 
def get_active_states (self)
 
def set_active_states (self, states)
 
def set_state_names_to_product (self, list_of_iters, repeat=1, trim=False)
 
- Public Member Functions inherited from nodes.DirectedNode.DirectedNode
def __init__ (self, id_num, name="blank")
 
def add_parent (self, node)
 
def add_parents (self, node_list)
 
def remove_parent (self, node)
 
def has_parent (self, node)
 
def add_child (self, node)
 
def add_children (self, node_list)
 
def remove_child (self, node)
 
def has_child (self, node)
 
def undirect (self)
 
def get_markov_blanket (self)
 
- Public Member Functions inherited from nodes.Node.Node
def __init__ (self, id_num, name="blank")
 
def __lt__ (self, other)
 
def add_neighbor (self, node)
 
def remove_neighbor (self, node)
 
def has_neighbor (self, node)
 

Public Attributes

 size
 
 state_names
 
 clique
 
 potential
 
- Public Attributes inherited from nodes.DirectedNode.DirectedNode
 parents
 
 children
 
 neighbors
 
- Public Attributes inherited from nodes.Node.Node
 id_num
 
 topo_index
 
 name
 
 neighbors
 
 visited
 

Properties

 active_states = property(get_active_states, set_active_states)
 

Private Attributes

 __active_states
 

Detailed Description

A BayesNode is a DirectedNode wih additional information such as a
Potential. A Potential is either a PD in the CBnet case, or a PAD in the
QBnet case. abbreviations in MyConstants.py. value of node = state of node.


Attributes
----------
__active_states : list[int]
    When all states are active, use range(self.size)
clique : Clique
    In a JoinTree, the family of any node belongs
    to exactly one clique, stored here. The family of a node
    is the node and its parents. The nodes on which a
    node's potential depends are its family.
potential : Potential
size : int
    number of values = number of states of node =
    size of node
state_names : list[str]

children : set[Node]
neighbors : set[Node]
parents : set[Node]
id_num : int
topo_index : int
name : str
visited : bool

Constructor & Destructor Documentation

def nodes.BayesNode.BayesNode.__init__ (   self,
  id_num,
  name = "blank",
  size = 2 
)
Constructor.

Parameters
----------
id_num : int
    This should be a different int for each node.
name : str
    The name of the node. Optional.

Returns
-------

Member Function Documentation

def nodes.BayesNode.BayesNode.forget_all_evidence (   self)
Expand list of self's active states to include all possible states from
0 to size-1.

Returns
-------
None
def nodes.BayesNode.BayesNode.get_active_states (   self)
Getter for active state list.

Returns
-------
list[int]
def nodes.BayesNode.BayesNode.resize (   self,
  size 
)
Add or remove nodes taking care to change everything that depends on
number of nodes.

Parameters
----------
size : int

Returns
-------
None
def nodes.BayesNode.BayesNode.set_active_states (   self,
  states 
)
Setter for active state list.

Parameters
----------
states : list[int]

Returns
-------
None
def nodes.BayesNode.BayesNode.set_potential (   self,
  pot 
)
Parameters
----------
pot : Potential

Returns
-------
None
def nodes.BayesNode.BayesNode.set_state_name (   self,
  position,
  name 
)
Changes name of state of node.

Parameters
----------
position : int
name : str

Returns
-------
None
def nodes.BayesNode.BayesNode.set_state_names_to_product (   self,
  list_of_iters,
  repeat = 1,
  trim = False 
)
Sets state names to a sequence of tuples generate by it.product().
trim option to remove punctuation marks.

Parameters
----------
list_of_iters : list[str] | list[list[int]]
    list of iterables like a list of one or more strings, or a list of
    one or more lists of ints
repeat : int
    In case list_of_iters is list of single string or list of single
    list of ints, repeat them
trim : bool
    Whether to keep punctuation or not. True removes white spaces,
    commas and parentheses
Returns
-------
None
def nodes.BayesNode.BayesNode.st_name_index (   self,
  st_name 
)
returns index in state_names list given name

Parameters
----------
st_name : str

Returns
-------
int

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