causally.scm.scm.LinearModel
- class causally.scm.scm.LinearModel(num_samples: int, graph_generator: GraphGenerator, noise_generator: RandomNoiseDistribution | Distribution, scm_context: SCMContext | None = None, min_weight: float = -1, max_weight: float = 1, min_abs_weight=0.05, seed: int | None = None)
Class for data generation from a linear structural causal model.
- Parameters:
num_samples (int) – Number of samples in the dataset.
graph_generator (GraphGenerator) – Random graph generator implementing the
get_random_graphmethod.noise_generator (Distribution) – Sampler of the noise random variables. It must be an instance of a class inheriting from
causally.scm.noise.Distribution, implementing thesamplemethod.scm_context (SCMContext, default None) –
SCMContextobject specifying the modeling assumptions of the SCM. IfNonethis is equivalent to anSCMContextobject with no assumption specified.min_weight (float, default is -1) – Minimum value of causal mechanisms weights
max_weight (float, default is 1) – Maximum value of causal mechanisms weights
min_abs_weight (float, default is 0.05) – Minimum value of the absolute value of any causal mechanism weight. Low value of min_abs_weight potentially lead to lambda-unfaithful distributions.
seed (int, default None) – Seed for reproducibility. If None, then the random seed is not set.
Methods
sample()Sample a dataset of observations.