netrd/reconstruction/mutual_information_matrix.py
def mutual_info_all_pairs(JointP, ProduP, N):
    """
    Calculate the mutual information between all pairs of nodes.

    Params
    ------
    JointP (dict): a dictionary where the keys are pairs of nodes in the graph and the
                   are nbins x nbins arrays corresponding to joint probability vectors
    ProduP (dict): a dictionary where the keys are pairs of nodes in the graph and the values
                   are nbins x nbins arrays corresponding to products of two probability vectors
    N (int): list of the minimum and maximum value in the time series

    Returns
    -------
    I (np.ndarray): the NxN mutual information matrix from a time series
    """

    I = np.zeros((N, N)) # initialize an empty matrix

    for l in range(N):
        for j in range(l):

            JointP_jl = JointP[(j,l)]
            ProduP_jl = ProduP[(j,l)]

            I[j,l] = mutual_info_node_pair(JointP_jl, ProduP_jl) # fill in the matrix
            I[l,j] = I[j,l] # this method is symmetric

    return I

    Calculate the mutual information between all pairs of nodes.

    Params
    ------
    JointP (dict): a dictionary where the keys are pairs of nodes in the graph and the
                   are nbins x nbins arrays corresponding to joint probability vectors
    ProduP (dict): a dictionary where the keys are pairs of nodes in the graph and the values
                   are nbins x nbins arrays corresponding to products of two probability vectors
    N (int): list of the minimum and maximum value in the time series

    Returns
    -------
    I (np.ndarray): the NxN mutual information matrix from a time series
    
Calculate the mutual information between all pairs of nodes.
Params

JointP (dict): a dictionary where the keys are pairs of nodes in the graph and the
are nbins x nbins arrays corresponding to joint probability vectors
ProduP (dict): a dictionary where the keys are pairs of nodes in the graph and the values
are nbins x nbins arrays corresponding to products of two probability vectors
N (int): list of the minimum and maximum value in the time series

Returns

I (np.ndarray): the NxN mutual information matrix from a time series
Calculate the mutual information between all pairs of nodes . Params JointP ( dict ) : a dictionary where the keys are pairs of nodes in the graph and the are nbins x nbins arrays corresponding to joint probability vectors ProduP ( dict ) : a dictionary where the keys are pairs of nodes in the graph and the values are nbins x nbins arrays corresponding to products of two probability vectors N ( int ) : list of the minimum and maximum value in the time series Returns I ( np . ndarray ) : the NxN mutual information matrix from a time series
def mutual_info_all_pairs(JointP, ProduP, N):
    I = np.zeros((N, N)) 
    for l in range(N):
        for j in range(l):
            JointP_jl = JointP[(j,l)]
            ProduP_jl = ProduP[(j,l)]
            I[j,l] = mutual_info_node_pair(JointP_jl, ProduP_jl) 
            I[l,j] = I[j,l] 
    return I
def mutual_info_all_pairs ( JointP , ProduP , N ) : I = np . zeros ( ( N , N ) ) for l in range ( N ) : for j in range ( l ) : JointP_jl = JointP [ ( j , l ) ] ProduP_jl = ProduP [ ( j , l ) ] I [ j , l ] = mutual_info_node_pair ( JointP_jl , ProduP_jl ) I [ l , j ] = I [ j , l ] return I
Calculate the mutual information between all pairs of nodes.
Calculate the mutual information between all pairs of nodes .
"""
    Calculate the mutual information between all pairs of nodes.

    Params
    ------
    JointP (dict): a dictionary where the keys are pairs of nodes in the graph and the
                   are nbins x nbins arrays corresponding to joint probability vectors
    ProduP (dict): a dictionary where the keys are pairs of nodes in the graph and the values
                   are nbins x nbins arrays corresponding to products of two probability vectors
    N (int): list of the minimum and maximum value in the time series

    Returns
    -------
    I (np.ndarray): the NxN mutual information matrix from a time series
    """ # initialize an empty matrix # fill in the matrix # this method is symmetric
JointP
ProduP
N