Module Index : Topics : Keywords
 
 
structure_learning.data.synthetic
index
/Users/165421/Documents/code/structure_learning/src/structure_learning/data/synthetic.py

## Simulate data
## https://github.com/ermongroup/BCD-Nets/blob/main/dag_utils.py

 
Modules
       
numpy
networkx
pandas
scipy.stats

 
Classes
       
builtins.object
SyntheticDataset

 
class SyntheticDataset(builtins.object)
    SyntheticDataset(num_nodes: float, num_obs: float, node_labels: list, degree: float, graph_type: str = 'erdos-renyi', noise_scale: float = 1.0, true_dag=None)
 
Generate synthetic data from graphs.
 
  Methods defined here:
__init__(self, num_nodes: float, num_obs: float, node_labels: list, degree: float, graph_type: str = 'erdos-renyi', noise_scale: float = 1.0, true_dag=None)
Initialise SyntheticDataset instance

Static methods defined here:
simulate_data(W: Union[numpy.ndarray, structure_learning.data_structures.dag.DAG], n, noise_scale=1.0, sigmas=None)
Simulate samples from SEM with specified type of noise.
 
Parameters:
    W (numpy.ndarray): weigthed DAG
    n (int): number of samples
    noise_scale (float): scale parameter of noise distribution in linear SEM
    sigmas (numpy.ndarray): noise vector
 
Returns:
    (numpy.ndarray) [n,d] sample matrix
simulate_data_V1(W: Union[numpy.ndarray, structure_learning.data_structures.dag.DAG], n, noise_scale=1.0, sigmas=None)
Simulate samples from SEM with specified type of noise.
 
Parameters:
    W (numpy.ndarray): weigthed DAG
    n (int): number of samples
    noise_scale (float): scale parameter of noise distribution in linear SEM
    sigmas (numpy.ndarray): noise vector
 
Returns:
    (numpy.ndarray) [n,d] sample matrix
simulate_data_from_dag(dag: Union[numpy.ndarray, structure_learning.data_structures.dag.DAG], num_obs, num_nodes, node_labels, w_range, noise_scale)
Simulate samples from ground truth DAG.
 
Parameters:
    DAG (numpy.ndarray): ground truth DAG
    num_obs (int): number of observations to simulate
    num_nodes (int): number of nodes
    node_labels (list (str)): node labels
    w_range (2-tuple (float)): weight range +/- (low, high)
    noise_scale (float): scale parameter of noise distribution
 
Returns:
    (numpy.ndarray): [n,d] sample matrix
simulate_gaussian_dag(d, w_std)
Simulate dense DAG adjacency matrix
 
Parameters:
    d (int): number of nodes
    w_std (float): weight std
 
Returns:
    (numpy.ndarray): weighted DAG
    None
    (numpy.ndarray): permutation matrix
    (numpy.ndarray): lower triangular matrix
simulate_random_dag(d, degree, graph_type, w_range)
Simulate random DAG with some expected degree.
 
Parameters:
    d (int): number of nodes
    degree (int): expected node degree, in + out
    graph_type (str): {erdos-renyi, barabasi-albert, full}
    w_range (2-tuple (float)): weight range +/- (low, high)
 
Returns:
    (DAG): weighted DAG
    None
    (numpy.ndarray): permutation matrix

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
Data
        Union = typing.Union
multivariate_normal = <scipy.stats._multivariate.multivariate_normal_gen object>