Class PythonGin
java.lang.Object
edu.cmu.tetrad.algcomparison.algorithm.other.PythonGin
- All Implemented Interfaces:
Algorithm, HasParameters, TetradSerializable, Serializable
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 inDEFAULT_PYTHON_EXEif not set.
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.Independence test method passed to causal-learn GIN. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetComparisonGraph(Graph graph) Deprecated.Returns a copy of the supplied graph for use as a comparison baseline.Deprecated.GIN operates on continuous (non-Gaussian) data.Deprecated.Returns a human-readable description of this algorithm.Deprecated.Returns the names of allParametersconsumed by this algorithm.search(DataModel dataModel, Parameters parameters) Deprecated.Runs GIN on the supplied dataset and returns the resulting causal graph.
-
Field Details
-
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
Deprecated.Runs GIN on the supplied dataset and returns the resulting causal graph.Execution steps:
- Write the dataset to a temporary CSV file.
- Spawn
gin_runner.pyas a subprocess, passing the CSV path, independence-test method, and alpha. - Read the JSON graph description from the process's stdout.
- Translate nodes and edges into a Tetrad
Graph, marking any latent nodes discovered by GIN withNodeType.LATENT.
- Specified by:
searchin interfaceAlgorithm- Parameters:
dataModel- the dataset; must be a continuousDataSetparameters- algorithm parameters (see class Javadoc)- Returns:
- the causal graph returned by GIN
- Throws:
IllegalArgumentException- ifdataModelis not aDataSetRuntimeException- wrapping anyIOExceptionorInterruptedExceptionfrom the subprocess
-
getComparisonGraph
Deprecated.Returns a copy of the supplied graph for use as a comparison baseline.- Specified by:
getComparisonGraphin interfaceAlgorithm- Parameters:
graph- the graph to copy- Returns:
- a new
EdgeListGraphwith the same nodes and edges
-
getDescription
Deprecated.Returns a human-readable description of this algorithm.- Specified by:
getDescriptionin interfaceAlgorithm- Returns:
- description string
-
getDataType
Deprecated.GIN operates on continuous (non-Gaussian) data.- Specified by:
getDataTypein interfaceAlgorithm- Returns:
DataType.Continuous
-
getParameters
Deprecated.Returns the names of allParametersconsumed by this algorithm.- Specified by:
getParametersin interfaceHasParameters- Returns:
- list of parameter key strings
-