Quantum Fog  0.9.3
Public Member Functions | List of all members
learning.AracneLner.AracneLner Class Reference
Inheritance diagram for learning.AracneLner.AracneLner:
Inheritance graph
[legend]
Collaboration diagram for learning.AracneLner.AracneLner:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, states_df, vtx_to_states=None)
 
def prune_ew_list (self, mi_array, ew_list)
 
def do_if_both_nds_old (self, j, k, nd_ids)
 
- Public Member Functions inherited from learning.ChowLiuTreeLner.ChowLiuTreeLner
def __init__ (self, states_df, vtx_to_states=None)
 
def learn_net_struc (self)
 
def prune_ew_list (self, mi_array, ew_list)
 
def do_if_both_nds_old (self, j, k, nd_ids)
 
- Public Member Functions inherited from learning.NetStrucLner.NetStrucLner
def __init__ (self, is_quantum, states_df, vtx_to_states=None)
 
def fill_bnet_with_parents (self, vtx_to_parents)
 

Additional Inherited Members

- Static Public Member Functions inherited from learning.NetStrucLner.NetStrucLner
def learn_nd_state_names (bnet, states_df)
 
def import_nd_state_names (bnet, vtx_to_states)
 
def int_sts_detector (sub_states_df)
 
- Public Attributes inherited from learning.NetStrucLner.NetStrucLner
 is_quantum
 
 bnet
 
 states_df
 
 ord_nodes
 

Detailed Description

The Aracne network was first used in Ref. 1. It is a simple variation of
the old Chow Liu Tree. It differs from the CL tree in 2 ways. We
implement those two differences by subclassing the ChowLiuTree class,
but overriding two of its methods.

As with CL trees, each edge is assigned the mutual info of its two
endpoint nodes.

Whereas CL trees use all edges, no matter how small their mutual info
is, arcane considers all triangles with nodes as vertices, and throws
away the edge of the triangle with the smallest mutual info. Then it
points the arrows in the 2 remaining edges so that the 2 arrows point in
the same direction, going from the edge with the larger to the edge with
the smaller mutual info. If the vertices of the triangle are x, y, z,
this is all consistent with the data processing inequality (see Cover
Thomas book on Info theory) H(x : z) <= min [ H(x:y), H(y:z) ] for the
bnet x->y->z

Whereas CL trees are trees, arcane graphs can have loops. This is
achieved by allowing connections between 2 nodes that have been used
before, something CL trees do not allow.

References
----------

1. ARACNE: an algorithm for the reconstruction of gene regulatory
networks in a mammalian cellular context, by  Margolin AA1, Nemenman I,
Basso K, Wiggins C, Stolovitzky G, Dalla Favera R, Califano A. (BMC
Bioinformatics. 2006 Mar 20;7 Suppl 1:S7)

Attributes
----------
is_quantum : bool
    True for quantum bnets amd False for classical bnets
bnet : BayesNet
    a BayesNet in which we store what is learned
states_df : pandas.DataFrame
    a Pandas DataFrame with training data. column = node and row =
    sample. Each row/sample gives the state of the col/node.


ord_nodes : list[DirectedNode]
    a list of DirectedNode's named and in the same order as the column
    labels of self.states_df.

Constructor & Destructor Documentation

def learning.AracneLner.AracneLner.__init__ (   self,
  states_df,
  vtx_to_states = None 
)
Constructor

Parameters
----------
states_df : pandas.DataFrame

vtx_to_states : dict[str, list[str]]
    A dictionary mapping each node name to a list of its state names.
    This information will be stored in self.bnet. If
    vtx_to_states=None, constructor will learn vtx_to_states
    from states_df

Returns
-------
None

Member Function Documentation

def learning.AracneLner.AracneLner.do_if_both_nds_old (   self,
  j,
  k,
  nd_ids 
)
This function processes the case when j and k are both old, i.e.,
have been visited already.

Parameters
----------
j : int
    j, k are integers (corresponding to position of node in the list
    states_df.columns) for an arrow j->k
k : int
nd_ids : list[int]
    list of integers corresponding to previously visited vertices in
    the order in which they were visited. Since j and k are old (
    i.e., have been visited already), they are both already in
    nd_ids. We will draw an arrow from the first of j, k that was
    visited to the second.

Returns
-------
None
def learning.AracneLner.AracneLner.prune_ew_list (   self,
  mi_array,
  ew_list 
)
This function takes as input an ew_list and returns that list pruned
(i.e., with some of its items removed). Items are removed by
considering vtx triangles i,j,k and removing one of the 3 edges of
the triangle, the one with smallest mutual info.

Parameters
----------
mi_array : numpy.array
    a square array with the mutual information of nodes i and j at
    position (i, j) with i < j.
ew_list : list[tuple(int, int, float)]
    an edge-weight (ew) list. An ew is a 3-tuple ( i, j, weight)
    representing an arrow i->j for ints i, j denoting vertices,
    with weight w equal to the mutual info between the two endpoints
    i, j of the arrow.

Returns
-------
list[tuple(int, int, float)]

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