causally.scm.scm.BaseStructuralCausalModel
- class causally.scm.scm.BaseStructuralCausalModel(num_samples: int, graph_generator: GraphGenerator, noise_generator: Distribution, scm_context: SCMContext | None = None, seed: int | None = None)
Base abstract class for synthetic data generation.
Classes inheriting from
BaseStructuralCausalModelmust implement the method_sample_mechanism, specifying how to sample effects from parents and noise terms observtations.- 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.seed (int, default None) – Seed for reproducibility. If
None, then the random seed is not set.
Methods
sample()Sample a dataset of observations.