causally.scm.scm.PostNonlinearModel

class causally.scm.scm.PostNonlinearModel(num_samples: int, graph_generator: GraphGenerator, noise_generator: RandomNoiseDistribution | Distribution, causal_mechanism: PredictionModel, invertible_function: InvertibleFunction, scm_context: SCMContext | None = None, seed: int | None = None)

Class for data generation from a postnonlinear model.

Parameters:
  • num_samples (int) – Number of samples in the dataset.

  • graph_generator (GraphGenerator) – Random graph generator implementing the get_random_graph method.

  • noise_generator (Distribution) – Sampler of the noise random variables. It must be an instance of a class inheriting from causally.scm.noise.Distribution, implementing the sample method.

  • causal_mechanism (PredictionModel) – Object for the generation of the nonlinear causal mechanism. It must be an instance of a class inheriting from causally.scm.causal_mechanism.PredictionModel, implementing the predict method.

  • invertible_function (InvertibleFunction) – Invertible post-nonlinearity. Invertibility is required for identifiability.

  • scm_context (SCMContext, default None) – SCMContext object specifying the modeling assumptions of the SCM. If None this is equivalent to an SCMContext object 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.