![]() |
Quantum Fog
0.9.3
|

Public Member Functions | |
| def | __init__ (self, is_quantum, states_df, vtx_to_states=None) |
| def | fill_bnet_with_parents (self, vtx_to_parents) |
Static Public Member Functions | |
| 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 | |
| is_quantum | |
| bnet | |
| states_df | |
| ord_nodes | |
Learning a Bayesian Network is usually done in two steps (1) learning
the structure (i.e. the graph or skeleton) (2) learning the parameters (
i.e., the pots).
NetStrucLner (Net Structure Learner) is a super class for all classes
that learn the structure of a net based on empirical data about states
given in a pandas dataframe called states_df.
NetParamsLner is a class for learning the parameters of a net (either a
cbnet or qbnet).
So far, Quantum Fog assumes that structure learning is all made, even in
the quantum case, from state data representing incoherent measurements
of all nodes. It's possible that in the future we will add some
schemes for predicting graph structure in the quantum case that use some
coherent measurements that yield both state and phase information.
IMPORTANT: We will use the word 'vtx' = vertex to denote a node name and
the word 'node' to denote a Node object.
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.
| def learning.NetStrucLner.NetStrucLner.__init__ | ( | self, | |
| is_quantum, | |||
| states_df, | |||
vtx_to_states = None |
|||
| ) |
Constructor
Parameters
----------
is_quantum : bool
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
-------
| def learning.NetStrucLner.NetStrucLner.fill_bnet_with_parents | ( | self, | |
| vtx_to_parents | |||
| ) |
Takes self.bnet with no arrows but named nodes a priori and fills it with arrows taken for a dictionary vtx_to_parents mapping vertices to a list of their parents Parameters ---------- vtx_to_parents : dict[str, [str]] Returns -------
|
static |
Enters vtx_to_states information into bnet.
Parameters
----------
bnet : BayesNet
vtx_to_states : dict[str, list[str]]
A dictionary mapping each node name to a list of its state names.
Returns
-------
None
|
static |
This function returns True iff the first row of sub_states_df has only int entries. We will assume that if the first row does, then all rows do. Parameters ---------- sub_states_df : pandas.DataFrame Returns ------- bool
|
static |
Compiles an alphabetically ordered list of the unique names in each column of states_df and makes those the state names of the corresponding node in bnet. Parameters ---------- bnet : BayesNet states_df : pandas.DataFrame Returns ------- None
1.8.11