dagma.utils.simulate_linear_sem

dagma.utils.simulate_linear_sem(W: numpy.ndarray, n: int, sem_type: str, noise_scale: float | list[float] | None = None) numpy.ndarray

Simulate samples from linear SEM with specified type of noise. For uniform, noise \(z \sim \mathrm{uniform}(-a, a)\), where \(a\) is the noise_scale.

Parameters:
W : np.ndarray

\([d, d]\) weighted adj matrix of DAG.

n : int

num of samples. When n=inf mimics the population risk, only for Gaussian noise.

sem_type : str

gauss, exp, gumbel, uniform, logistic, poisson

noise_scale : Optional[Union[float,List[float]]], optional

scale parameter of the additive noises. If None, all noises have scale 1. Default: None.

Returns:

\([n, d]\) sample matrix, \([d, d]\) if n=inf.

Return type:

np.ndarray


Last update: Jan 14, 2024