Class PythonGin

java.lang.Object
edu.cmu.tetrad.algcomparison.algorithm.other.PythonGin
All Implemented Interfaces:
Algorithm, HasParameters, TetradSerializable, Serializable

@Deprecated public class PythonGin extends Object implements Algorithm
Deprecated.
Wraps the causal-learn GIN (Generalized Independent Noise) algorithm, invoking it as a one-shot Python subprocess via gin_runner.py and translating the returned GeneralGraph into a Tetrad Graph.

GIN discovers causal structure among observed variables in the presence of latent confounders, under a Linear Non-Gaussian Latent Hierarchical Model (LiNGLaH). It returns a graph containing both the original observed nodes and any latent nodes it infers; latent nodes are marked with NodeType.LATENT.

Reference: Xie, F., Cai, R., Huang, B., Glymour, C., Hao, Z., & Zhang, K. (2020). Generalized independent noise condition for estimating latent variable causal graphs. NeurIPS 33, 14891–14902. Required Parameters

  • Params.PYTHON_EXE — path to the Python executable (e.g., /usr/bin/python3). Defaults to the venv path in DEFAULT_PYTHON_EXE if not set.
Optional Parameters
  • "ginIndepTestMethod" — independence test used internally by GIN: "kci" (default) or "hsic"
  • Params.ALPHA — significance level (default 0.05). Note: causal-learn's GIN does not currently expose alpha as a direct parameter; it is passed to the script for forward compatibility.
See Also:
  • Field Details

    • GIN_INDEP_TEST

      public static final String GIN_INDEP_TEST
      Deprecated.
      Independence test method passed to causal-learn GIN. Supported values: "kci" (default), "hsic".
      See Also:
  • Constructor Details

    • PythonGin

      public PythonGin()
      Deprecated.
      Default constructor for the PythonGin class. This constructor initializes a new instance of the PythonGin algorithm. It provides access to methods for executing the GIN causal discovery process using a Python-based implementation and facilitates interactions between Java and Python scripts.
  • Method Details

    • search

      public Graph search(DataModel dataModel, Parameters parameters)
      Deprecated.
      Runs GIN on the supplied dataset and returns the resulting causal graph.

      Execution steps:

      1. Write the dataset to a temporary CSV file.
      2. Spawn gin_runner.py as a subprocess, passing the CSV path, independence-test method, and alpha.
      3. Read the JSON graph description from the process's stdout.
      4. Translate nodes and edges into a Tetrad Graph, marking any latent nodes discovered by GIN with NodeType.LATENT.
      Specified by:
      search in interface Algorithm
      Parameters:
      dataModel - the dataset; must be a continuous DataSet
      parameters - algorithm parameters (see class Javadoc)
      Returns:
      the causal graph returned by GIN
      Throws:
      IllegalArgumentException - if dataModel is not a DataSet
      RuntimeException - wrapping any IOException or InterruptedException from the subprocess
    • getComparisonGraph

      public Graph getComparisonGraph(Graph graph)
      Deprecated.
      Returns a copy of the supplied graph for use as a comparison baseline.
      Specified by:
      getComparisonGraph in interface Algorithm
      Parameters:
      graph - the graph to copy
      Returns:
      a new EdgeListGraph with the same nodes and edges
    • getDescription

      public String getDescription()
      Deprecated.
      Returns a human-readable description of this algorithm.
      Specified by:
      getDescription in interface Algorithm
      Returns:
      description string
    • getDataType

      public DataType getDataType()
      Deprecated.
      GIN operates on continuous (non-Gaussian) data.
      Specified by:
      getDataType in interface Algorithm
      Returns:
      DataType.Continuous
    • getParameters

      public List<String> getParameters()
      Deprecated.
      Returns the names of all Parameters consumed by this algorithm.
      Specified by:
      getParameters in interface HasParameters
      Returns:
      list of parameter key strings