netrd/reconstruction/ou_inference.py
def inverse_method(covariance, temperatures):
    """This function finds the weights of an heterogenous Ornstein-Uhlenbeck 
    process 
    covariance  = covariance matrix of the zero-mean signal

    Params
    ------

    covariance (np.ndarray): Covariance matrix of the zero-mean signal.

    temperatures (np.ndarray): Diffusion coefficient of each of the signals.

    Returns
    -------

    weights (np.ndarray): Coupling between nodes under the OU process asumption.

    """

    if len(np.shape(temperatures)) == 1:
        T = np.diag(temperatures)
    elif len(np.shape(temperatures)) == 2:
        T = temperatures
    else:
        raise ValueError("temperature must either be a vector or a matrix.")

    n, m = np.shape(covariance)

    eig_val, eig_vec = eig(-covariance)
    eig_val = np.diag(eig_val)

    e_mat = np.matmul(eig_vec.T, np.matmul(T, eig_vec))

    eig_val = np.matmul(np.ones([n, n]), eig_val)
    eig_val = (eig_val + eig_val.T)**(-1)
    eig_val = eig_val.real
    weights = -np.matmul(eig_vec, np.matmul(2 * eig_val * e_mat, eig_vec.T))

    return weights
This function finds the weights of an heterogenous Ornstein-Uhlenbeck 
    process 
    covariance  = covariance matrix of the zero-mean signal

    Params
    ------

    covariance (np.ndarray): Covariance matrix of the zero-mean signal.

    temperatures (np.ndarray): Diffusion coefficient of each of the signals.

    Returns
    -------

    weights (np.ndarray): Coupling between nodes under the OU process asumption.

    
This function finds the weights of an heterogenous Ornstein-Uhlenbeck
process
covariance  = covariance matrix of the zero-mean signal

Params

covariance (np.ndarray): Covariance matrix of the zero-mean signal.

temperatures (np.ndarray): Diffusion coefficient of each of the signals.

Returns

weights (np.ndarray): Coupling between nodes under the OU process asumption.
This function finds the weights of an heterogenous Ornstein - Uhlenbeck process covariance = covariance matrix of the zero - mean signal Params covariance ( np . ndarray ) : Covariance matrix of the zero - mean signal . temperatures ( np . ndarray ) : Diffusion coefficient of each of the signals . Returns weights ( np . ndarray ) : Coupling between nodes under the OU process asumption .
def inverse_method(covariance, temperatures):
    if len(np.shape(temperatures)) == 1:
        T = np.diag(temperatures)
    elif len(np.shape(temperatures)) == 2:
        T = temperatures
    else:
        raise ValueError("temperature must either be a vector or a matrix.")
    n, m = np.shape(covariance)
    eig_val, eig_vec = eig(-covariance)
    eig_val = np.diag(eig_val)
    e_mat = np.matmul(eig_vec.T, np.matmul(T, eig_vec))
    eig_val = np.matmul(np.ones([n, n]), eig_val)
    eig_val = (eig_val + eig_val.T)**(-1)
    eig_val = eig_val.real
    weights = -np.matmul(eig_vec, np.matmul(2 * eig_val * e_mat, eig_vec.T))
    return weights
def inverse_method ( covariance , temperatures ) : if len ( np . shape ( temperatures ) ) == 1 : T = np . diag ( temperatures ) elif len ( np . shape ( temperatures ) ) == 2 : T = temperatures else : raise ValueError ( "temperature must either be a vector or a matrix." ) n , m = np . shape ( covariance ) eig_val , eig_vec = eig ( - covariance ) eig_val = np . diag ( eig_val ) e_mat = np . matmul ( eig_vec . T , np . matmul ( T , eig_vec ) ) eig_val = np . matmul ( np . ones ( [ n , n ] ) , eig_val ) eig_val = ( eig_val + eig_val . T ) ** ( - 1 ) eig_val = eig_val . real weights = - np . matmul ( eig_vec , np . matmul ( 2 * eig_val * e_mat , eig_vec . T ) ) return weights
This function finds the weights of an heterogenous Ornstein-Uhlenbeck
process
covariance  = covariance matrix of the zero-mean signal
This function finds the weights of an heterogenous Ornstein - Uhlenbeck process covariance = covariance matrix of the zero - mean signal
"""This function finds the weights of an heterogenous Ornstein-Uhlenbeck 
    process 
    covariance  = covariance matrix of the zero-mean signal

    Params
    ------

    covariance (np.ndarray): Covariance matrix of the zero-mean signal.

    temperatures (np.ndarray): Diffusion coefficient of each of the signals.

    Returns
    -------

    weights (np.ndarray): Coupling between nodes under the OU process asumption.

    """
covariance
temperatures