Class NonlinearFunctionOfLinear

java.lang.Object
edu.cmu.tetrad.sem.NonlinearFunctionOfLinear

public class NonlinearFunctionOfLinear extends Object
Represents a nonlinear function of linear model for generating synthetic data based on a directed acyclic graph (DAG). The error may be included additively or post-nonlinearly--that is, the nonlinear function may be taken either before (additively) or after (post-nonlinearly) an independent draw from the noise distribution is added.

If additively, the model is Xi = fi(a1 Xi_1 + a2 Xi_2 + ... + ak Xi_k) + Ni.

If post-nonlinearly, the model is Xi = fi(a1 Xi_1 + a2 Xi_2 + ... + ak Xi_k + Ni).

Additively, the model is a special case of the nonlinear additive model in Hoyer et al. (2008),

xi = fi(Paj) + Ni

We have interpreted fi here as a nonlinear function over a linear combination of parents.

Post-nonlinearly, the error is added inside the fi function. In the bivariate case, this is a special case of the post-nonlinear model in Zhang and Hyvarinen (2012); we are using the term 'post-nonlinear' in a more general sense here, allowing for arbitrary smooth nonlinear functions.

In either case, we choose random functions fi using multilayer perceptrons from R to R with one hidden layer and tanh activation functions. The number of hidden neurons is a parameter.

Hoyer, P., Janzing, D., Mooij, J. M., Peters, J., & Schölkopf, B. (2008). Nonlinear causal discovery with additive noise models. Advances in neural information processing systems, 21.

Chu, T., Glymour, C., & Ridgeway, G. (2008). Search for Additive Nonlinear Time Series Causal Models. Journal of Machine Learning Research, 9(5).

Bühlmann, P., Peters, J., & Ernest, J. (2014). "CAM: Causal Additive Models, high-dimensional order search and penalized regression". The Annals of Statistics.

Peters, J., Mooij, J. M., Janzing, D., & Schölkopf, B. (2014). "Causal Discovery with Continuous Additive Noise Models". Journal of Machine Learning Research.

Zhang, K., & Hyvarinen, A. (2012). On the identifiability of the post-nonlinear causal model. arXiv preprint arXiv:1205.2599.

Hastie, T., & Tibshirani, R. (1986). "Generalized Additive Models".

Hyvarinen, A., & Pajunen, P. (1999). "Nonlinear Independent Component Analysis: Existence and Uniqueness Results"

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    Represents the type of distortion applied in a nonlinear additive causal model.
  • Constructor Summary

    Constructors
    Constructor
    Description
    NonlinearFunctionOfLinear(Graph graph, int numSamples, org.apache.commons.math3.distribution.RealDistribution noiseDistribution, double rescaleMin, double rescaleMax, double coefLow, double coefHigh, boolean coefSymmetric, int hiddenDimension, double inputScale)
    Constructs a NonlinearFunctionOfLinear instance, which generates synthetic data based on a directed acyclic graph (DAG) using post-nonlinear causal relationships and associated modeling parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Generates synthetic data based on a directed acyclic graph (DAG) with causal relationships and post-nonlinear causal mechanisms.
    void
    Sets the type of distortion to be applied in the nonlinear additive causal model.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NonlinearFunctionOfLinear

      public NonlinearFunctionOfLinear(Graph graph, int numSamples, org.apache.commons.math3.distribution.RealDistribution noiseDistribution, double rescaleMin, double rescaleMax, double coefLow, double coefHigh, boolean coefSymmetric, int hiddenDimension, double inputScale)
      Constructs a NonlinearFunctionOfLinear instance, which generates synthetic data based on a directed acyclic graph (DAG) using post-nonlinear causal relationships and associated modeling parameters.
      Parameters:
      graph - The directed acyclic graph defining causal relationships between variables. Must not contain cycles.
      numSamples - The number of samples to be generated. Must be a positive integer.
      noiseDistribution - The distribution from which the random noise will be sampled.
      rescaleMin - The minimum value for rescaling the generated data. Must be less than or equal to rescaleMax.
      rescaleMax - The maximum value for rescaling the generated data. Must be greater than or equal to rescaleMin.
      coefLow - The lower bound for the uniform sampling of coefficients.
      coefHigh - The upper bound for the uniform sampling of coefficients.
      coefSymmetric - Indicates whether coefficient sampling should be symmetric around zero.
      hiddenDimension - The dimensionality of hidden variables in the model.
      inputScale - A scaling factor applied to the inputs of the nonlinear functions.
  • Method Details

    • generateData

      public DataSet generateData()
      Generates synthetic data based on a directed acyclic graph (DAG) with causal relationships and post-nonlinear causal mechanisms. The data generation process involves simulating parent-child relationships in the graph, applying noise, rescaling, and applying random piecewise linear transformations.
      Returns:
      A DataSet object containing the generated synthetic data, with samples and variables defined by the structure of the provided graph and simulation parameters.
    • setDistortionType

      public void setDistortionType(NonlinearFunctionOfLinear.DistortionType distortionType)
      Sets the type of distortion to be applied in the nonlinear additive causal model.
      Parameters:
      distortionType - The DistortionType to set. Determines the distortion mechanism used to modify the data in the causal model. Valid values are: - NONE: No distortion applied. - PRE_NOISE: Noise added after the nonlinear distortion. - POST_NONLINEAR: Noise added before the nonlinear distortion.