API

Graph generators

Classes for generation of random graphs.

ErdosRenyi(num_nodes[, expected_degree, ...])

Generator of Erdos-Renyi directed acyclic graphs.

BarabasiAlbert(num_nodes, expected_degree[, ...])

Generator of Scale Free directed acyclic graphs.

GaussianRandomPartition(num_nodes, p_in, ...)

Generator of Gaussian Random Partition directed acyclic graphs.

CustomGraph(adjacency)

Generator of user-specified, deterministic, graphs

Causal mechanisms

causally predefines linear and nonlinear causal mechanisms for the definition of structural equations.

LinearMechanism([min_weight, max_weight, ...])

Linear causal mechanism by linear regression.

NeuralNetMechanism([weights_mean, ...])

Nonlinear causal mechanism parametrized by a neural network.

GaussianProcessMechanism([gamma])

Nonlinear causal mechanism sampled from a Gaussian process.

InvertibleFunction(function)

Base class for defining invertible functions for the post-nonlinear model.

Noise distributions

Classes for random noise generation according to different parametric and nonparametric distributions.

RandomNoiseDistribution([standardize])

Base abstract class for sampling from non-parametric, randomly generated, distributions.

MLPNoise([hidden_dim, activation, bias, ...])

Samples form adistribution defined by a neural network applied to a standard normal.

Normal([loc, std])

Wrapper for numpy.random.normal() sampler.

Exponential([scale])

Wrapper for numpy.random.exponential() sampler.

Uniform([low, high])

Wrapper for numpy.random.uniform() sampler.

Structural causal models

causally implements linear, additive nonlinear, and post-nonlinear structural causal models. Additionally, it allows data generation from SCMs with mixed linear and nonlinear structural equations.

BaseStructuralCausalModel(num_samples, ...)

Base abstract class for synthetic data generation.

AdditiveNoiseModel(num_samples, ...[, ...])

Class for data generation from a nonlinear additive noise model.

LinearModel(num_samples, graph_generator, ...)

Class for data generation from a linear structural causal model.

PostNonlinearModel(num_samples, ...[, ...])

Class for data generation from a postnonlinear model.

MixedLinearNonlinearModel(num_samples, ...)

Class for data generation with mixed linear and nonlinear mechanisms.

Challenging assumptions

causally allows specifying challenging modeling assumptions on the SCM such as presence of latent confounders, unfaithfulness of the data distribution, presence of measurement errors and autoregressive effects. Assumptions are specified through an instance of the SCMContext class, which serves as a container of the SCM modeling assumptions.

SCMContext.confounded_model(p_confounder)

Make the assumption of model with latent confounders.

SCMContext.unfaithful_model(p_unfaithful)

Make the assumption of model with distribution unfaithful to the graph.

SCMContext.autoregressive_model(order)

Make the assumption of model with time lagged autoregressive effects.

SCMContext.measure_err_model(gamma)

Make the assumption of model with measurement error.