RandomDAGGenerator
RandomDAGGenerator
A class for the creation of random DAGs, with a potential causal interpretation.
Source code in src/generators/random_dag_generator.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
generate(num_nodes=DEFAULT_NUM_NODES, edge_prob=DEFAULT_EDGE_PROB, edge_weight_range=DEFAULT_EDGE_WEIGHT_RANGE, edge_noise_sd_range=DEFAULT_EDGE_NOISE_SD_RANGE, out_path=None)
classmethod
Generates a random DAG pased on the provided parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
num_nodes |
int
|
The number of nodes in the DAG. |
DEFAULT_NUM_NODES
|
edge_prob |
float
|
The probability of an edge existing between any two nodes. |
DEFAULT_EDGE_PROB
|
edge_weight_range |
tuple[float, float]
|
The range of edge weights. |
DEFAULT_EDGE_WEIGHT_RANGE
|
edge_noise_sd_range |
tuple[float, float]
|
The range of edge noise standard deviations. |
DEFAULT_EDGE_NOISE_SD_RANGE
|
out_path |
str
|
The path to write the DAG to. If None, the DAG is not written out. |
None
|
Returns:
Type | Description |
---|---|
dict[str, object]
|
A dictionary with the following elements: |
dict[str, object]
|
|
dict[str, object]
|
|
dict[str, object]
|
|
dict[str, object]
|
|
Source code in src/generators/random_dag_generator.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|