iscan.utils.DataGenerator
¶
-
class iscan.utils.DataGenerator(d: int, s0: int, graph_type: str, noise_std: float | numpy.ndarray | list[float] =
0.5
, noise_type: str ='Gaussian'
)¶ Generate synthetic data to evaluate shifted nodes and shifted edges
Defines the class of graphs and data to be generated.
- Parameters:¶
- d : int¶
Number of variables
- s0 : int¶
Expected number of edges in the random graphs
- graph_type : str¶
One of
["ER", "SF"]
.ER
andSF
refer to Erdos-Renyi and Scale-free graphs, respectively.- noise_std : Union[float, np.ndarray, List[float]], optional¶
Sets the scale (variance) of the noise distributions. Should be either a scalar, or a list (array) of dim d. By default 1.
- noise_type : str, optional¶
One of
["Gaussian", "Laplace", "Gumbel"]
, by default “Gaussian”.
Methods¶
_simulate_dag
(→ numpy.ndarray)Simulate random DAG with some expected number of edges.
_sample_GP
(X[, lengthscale])_choose_shifted_nodes
(→ numpy.ndarray)Randomly choose shifted nodes
_delete_edges
(→ numpy.ndarray)Generates a new adjacency matrix where some incoming edges (parents) are randomly deleted for the shifted nodes.
_sample_from_same_structs
(→ Tuple[numpy.ndarray, ...)Sample data where both DAGs have the same structure
_sample_from_diff_structs
(→ Tuple[numpy.ndarray, ...)Sample data where both DAGs have the different structures
sample
(→ Tuple[numpy.ndarray, numpy.ndarray])Samples two datasets from randomly generated DAGs