Functions for manipulating probability distributions.
Normalize a distribution.
Parameters: a (np.ndarray) – The array to normalize. Returns:
anormalized so that the sum of its entries is 1.
Return type: np.ndarray
Return the uniform distribution for a set of binary nodes, indexed by state (so there is one dimension per node, the size of which is the number of possible states for that node).
Parameters: nodes (np.ndarray) – A set of indices of binary nodes. Returns: The uniform distribution over the set of nodes. Return type: np.ndarray
Return the marginal probability that the node is OFF.
Get the marginal distribution for a node.
Check whether the repertoire is independent.
The purview of the repertoire.
Parameters: repertoire (np.ndarray) – A repertoire Returns: The purview that the repertoire was computed over. Return type: tuple[int]
Return the size of the purview of the repertoire.
Parameters: repertoire (np.ndarray) – A repertoire Returns: The size of purview that the repertoire was computed over. Return type: int
Return the shape a repertoire.
- purview (tuple[int]) – The purview over which the repertoire is computed.
- N (int) – The number of elements in the system.
The shape of the repertoire. Purview nodes have two dimensions and non-purview nodes are collapsed to a unitary dimension.
>>> purview = (0, 2) >>> N = 3 >>> repertoire_shape(purview, N) [2, 1, 2]
Flatten a repertoire, removing empty dimensions.
By default, the flattened repertoire is returned in little-endian order.
Parameters: repertoire (np.ndarray or None) – A repertoire. Keyword Arguments: big_endian (boolean) – If
True, flatten the repertoire in big-endian order.
Returns: The flattened repertoire. Return type: np.ndarray
Return the maximum entropy distribution over a set of nodes.
This is different from the network’s uniform distribution because nodes outside
node_indicesare fixed and treated as if they have only 1 state.
- node_indices (tuple[int]) – The set of node indices over which to take the distribution.
- number_of_nodes (int) – The total number of nodes in the network.
The maximum entropy distribution over the set of nodes.