![]() |
Quantum Fog
0.9.3
|
Public Member Functions | |
| def | __init__ (self, is_quantum, bnet, num_samples, use_int_sts) |
| def | sam_generator (self) |
| def | write_csv (self, sts_file_path, degs_file_path=None) |
Public Attributes | |
| is_quantum | |
| bnet | |
| num_samples | |
| use_int_sts | |
| topo_nd_list | |
RandGen_NetParams (Random Generator of Net Parameters). This class
generates random parameters (i.e. either a single pot or all pots) for a
given bnet structure.
The states are sampled the same way in the classical and quantum cases.
In the quantum case, if a node C with parents pa(C) has C=x and pa(C)=y,
where x and y are the sampled states, then we set the phase of node C
equal to the phase of the amplitude A( C=x | pa(C)=y ).
Attributes
----------
bnet : BayesNet
The pots of this bnet are sampled to generate a states_df and
also a degs_df in the quantum case.
use_int_sts : bool
If False, states_df has state names as entries. If True, states_df
has int entries. The int entries are the index in the states_names
list of the node for that column.
is_quantum : bool
True if quantum bnets and False if classical ones
num_samples : int
The number of samples = len(states_df.index) = len(degs_df.index)
topo_nd_list : list[BayesNode]
List of the nodes of the bnet in topological (=chronological) order,
root node first
| def learning.RandGen_NetParams.RandGen_NetParams.__init__ | ( | self, | |
| is_quantum, | |||
| bnet, | |||
| num_samples, | |||
| use_int_sts | |||
| ) |
Constructor Parameters ---------- is_quantum : bool bnet : BayesNet num_samples : int use_int_sts : bool Returns -------
| def learning.RandGen_NetParams.RandGen_NetParams.sam_generator | ( | self | ) |
A generator of samples. The generator yields two dictionaries, nd_to_int_st and nd_to_degs. nd_to_int_st maps each node to its sampled state given as an integer (the integer being the index of the state in the node_states list of the node). In the quantum case, nd_to_degs maps each node to its sampled phase in degrees. In the classical case, nd_to_degs = None Returns ------- (dict[int], dict[float])
| def learning.RandGen_NetParams.RandGen_NetParams.write_csv | ( | self, | |
| sts_file_path, | |||
degs_file_path = None |
|||
| ) |
Writes a cvs file (comma separated values) for states_df at the path sts_file_path and for degs_df at the path degs_file_path Parameters ---------- sts_file_path : str degs_file_path : str or NoneType Returns -------
1.8.11