Package: manm-cs
MANM-CSData generation module for benchmarking methods for causal structure learning (CSL) from mixed discrete-continuous and nonlinear observational data based upon the mixed additive noise model (MANM).
The related paper"MANM-CS: Data Generation for Benchmarking Causal Structure Learning from Mixed Discrete-Continuous and Nonlinear Data"was published at the NeurIPS-21 Workshop"Causal Inference & Machine Learning: Why now?".Getting startedInstallation / Usage via pippython3 -m pip install manm-cs
python3 -m manm_cs --num_nodes 10 --edge_density 0.5 --num_samples 10000 --discrete_node_ratio 0.5Installation from SourceGet the codeStart by cloning this repository.git clone git@github.com:hpi-epic/manm-cs.git
cd manm-csInstall requirements within venvPlease make sure you have Python 3 installed. We tested the execution of our data generation with Python 3.9.
We recommend installing the requirements defined inrequirements.txtusingvirtualenv.MacOS / Linux# Install virtualenv
python3 -m pip install --user virtualenv

# Create a new virtual environment
python3 -m venv env

# Activate the virtual environment
source env/bin/activateWindows# Install virtualenv
py -m pip install --user virtualenv

# Create a new virtual environment
py -m venv env

# Activate the virtual environment
.\env\Scripts\activateAfter the creation of a new virtual environment, we can install the project dependencies defined insetup.cfgfor both platforms.python3 -m pip install .Execute data generationYou can start the data generation with following command. The generated graph and the dataset are saved as ground_truth.gml and samples.csv in the current working directory. Available parameters for data generation can be seen withpython3 -m manm_cs --help.python3 -m manm_cs \
    --num_nodes 10 \
    --edge_density 0.5 \
    --num_samples 10000 \
    --discrete_node_ratio 0.5Build Releasepython3 -m pip install --upgrade build twine
python3 -m build

# Upload to testPyPi
# use __token__ as username and the pypi token as password
python3 -m twine upload --repository testpypi dist/*

# Upload to PyPi
python3 -m twine upload dist/*ParametersnameValue RangeDefaultDescriptionnum_nodes[1, Inf)NoneDefines the number of nodes to be in the generated DAG.edge_density[0, 1]NoneDefines the density of edges in the generated DAG.discrete_node_ratio[0, 1]NoneDefines the percentage of nodes that shall be of discrete type. Depending on its value the appropriate model (multivariate normal, mixed gaussian, discrete only) is chosen.num_samples[1, Inf)NoneDefines the number of samples that shall be generated from the DAG.discrete_signal_to_noise_ratio[0, 1]0.5Defines the ratio of uniform noise added within the mixed additive noise model, i.e., 0 = no noise, and 1 = uniform discrete noisemin_discrete_value_classes[2, Inf)3Defines the minimum number of discrete classes a discrete variable shall have.max_discrete_value_classes[2, Inf)4Defines the maximum number of discrete classes a discrete variable shall have.continuous_noise_std[0, Inf)1.0Defines the standard deviation of gaussian noise added to continuous variables.functions([0, 1], func)idA list of probabilities and mathmatical functions for relationships between two continuous nodes. Note, the input are tuples (probability, function), where the sum of all probabilities has to equal 1. Command line supported functions are: [linear, quadratic, cubic, tanh, sin, cos]num_processes[1, Inf)1Number of processes used for data samplingconditional_gaussian0 or 11'1' Defines that conditional gaussian model is assumed for a mixture of variables. Otherwise '0', discrete variables can have continuous parents.beta_lower_limit(0, Inf)0.5Lower limit for beta values for influence of continuous parents. Betas are sampled uniform from the union of [-upper,-lower] and [lower,upper]. Upper limit see below.beta_upper_limit(0, Inf)1Upper limit for beta values for influence of continuous parents. Betas are sampled uniform from the union of [-upper,-lower] and [lower,upper]. Lower limit see above.graph_structure_fileNoneDefines a path to a .gml file for a fixed DAG structure (ignoring node and edge characteristics) used during manm_cs graph building. Note graph_structure_file is mutually exclusive to num_nodes and edge_density.variables_scaling{'normal', 'standard', 'rank', 'rank', 'uniform'}None'Scale the continuous variables ('normal' or standard') or all variables ('rank' or 'uniform’) in the dataset once all samples are generated.scale_parents0 or 10Defines if the influence of the parents on a child node is scaled, e.g., the sum of values of the parents is divided by the number of parents for a continuous child node.LicenseMIT