Package edu.cmu.tetrad.search
Class IcaLingD
java.lang.Object
edu.cmu.tetrad.search.IcaLingD
ICA-LiNG-D (Lacerda, Spirtes, Ramsey, Hoyer, 2012).
Stability hardening: - Uses fixed FastICA (sym. update derivative, whitening ridge, orthonormal wInit). - Robust diagonal scaling with epsilon guard. - Prefer Hungarian "best-diagonal" permutation; then enumerate NRooks permutations. - Spectral radius stability check with small tolerance.
API is unchanged.
- Version:
- $Id: $Id
- Author:
- peterspirtes, gustavolacerda, patrickhoyer, josephramsey
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MatrixEstimates the weight matrix W using the Fast Independent Component Analysis (FastICA) algorithm.static MatrixestimateW(DataSet data, int fastIcaMaxIter, double fastIcaTolerance, double fastIcaA, boolean verbose) Estimates the weight matrix (W) using the Fast Independent Component Analysis (FastICA) algorithm.Convenience: estimate W via FastICA, then enumerate B̂ candidates.static MatrixBuild B̂ from a permutation result; robust to tiny diagonals.Local LiNG-D from a given W: 1) Threshold W (small entries -> 0).static booleanSpectral-radius stability with small tolerance.static @NotNull GraphConstructs a directed graph based on the input binary adjacency matrix and a list of nodes.static PermutationMatrixPairComputes a permutation matrix pair that maximizes the diagonal elements of a given matrix W.static MatrixScale columns by their diagonal (guarding tiny/zero).voidsetBThreshold(double bThreshold) Sets the threshold value for the `bThreshold` field.voidsetWThreshold(double wThreshold) Sets the threshold value for the `wThreshold` field.static MatrixHard threshold (copy).
-
Constructor Details
-
IcaLingD
public IcaLingD()Default constructor for the IcaLingD class.This initializes an instance of the IcaLingD class, which provides functionality related to Independent Component Analysis (ICA) and Linear Non-Gaussian Acyclic Model (LiNGAM) for directional inference and graph estimation tasks.
-
-
Method Details
-
estimateW
public static Matrix estimateW(DataSet data, int fastIcaMaxIter, double fastIcaTolerance, double fastIcaA) Estimates the weight matrix W using the Fast Independent Component Analysis (FastICA) algorithm.- Parameters:
data- the input dataset used for the estimation processfastIcaMaxIter- the maximum number of iterations for the FastICA algorithmfastIcaTolerance- the convergence tolerance for the FastICA algorithmfastIcaA- the scaling parameter used for the FastICA nonlinearity function- Returns:
- the estimated weight matrix W
-
estimateW
public static Matrix estimateW(DataSet data, int fastIcaMaxIter, double fastIcaTolerance, double fastIcaA, boolean verbose) Estimates the weight matrix (W) using the Fast Independent Component Analysis (FastICA) algorithm. This method centers and preprocesses the input data, applies the FastICA algorithm, and optionally logs Anderson Darling test results for non-Gaussianity of the input variables if verbose mode is enabled.- Parameters:
data- the input dataset containing variables used for the estimation processfastIcaMaxIter- the maximum number of iterations for the FastICA algorithmfastIcaTolerance- the convergence tolerance threshold for the FastICA algorithmfastIcaA- the scaling parameter alpha used in the FastICA nonlinearity functionverbose- a flag indicating whether logging of intermediate results, such as non-Gaussianity statistics, should be enabled- Returns:
- the estimated weight matrix (W) derived from the FastICA algorithm
-
makeGraph
Constructs a directed graph based on the input binary adjacency matrix and a list of nodes. The method creates a graph where an edge is added from node j to node i if the value at position (i, j) in the matrix is non-zero.- Parameters:
B- the binary adjacency matrix representing the edge structure of the graphvariables- the list of nodes corresponding to the graph's variables- Returns:
- the constructed directed graph
-
maximizeDiagonal
Computes a permutation matrix pair that maximizes the diagonal elements of a given matrix W. This involves finding an optimal arrangement of rows and columns to achieve this goal.- Parameters:
W- the matrix for which the diagonal is to be maximized- Returns:
- a PermutationMatrixPair containing the optimized permutations and resulting matrix
-
isStable
Spectral-radius stability with small tolerance.- Parameters:
bHat- the matrix to check for spectral radius stability- Returns:
- true if the spectral radius of the matrix is less than 1 - STAB_TOL, false otherwise
-
scale
Scale columns by their diagonal (guarding tiny/zero).- Parameters:
M- the matrix to scale- Returns:
- the scaled matrix
-
threshold
Hard threshold (copy).- Parameters:
M- the matrix to thresholdthreshold- the threshold value- Returns:
- the thresholded matrix
-
getScaledBHat
Build B̂ from a permutation result; robust to tiny diagonals.- Parameters:
pair- the permutation matrix pair- Returns:
- the scaled B̂ matrix
-
fit
Convenience: estimate W via FastICA, then enumerate B̂ candidates.- Parameters:
D- the dataset to fit- Returns:
- the list of scaled B̂ matrices
-
getScaledBHats
Local LiNG-D from a given W: 1) Threshold W (small entries -> 0). 2) Try best-diagonal permutation (Hungarian) first; then all NRooks permutations. 3) For each permutation, scale to WTilde with diag≈1, form B̂ = I - WTilde, threshold B̂. 4) Return the list (caller can filter with isStable).- Parameters:
W- the weight matrix to process- Returns:
- the list of scaled B̂ matrices
-
setBThreshold
public void setBThreshold(double bThreshold) Sets the threshold value for the `bThreshold` field. This is used to define a specific limit or boundary for the `bThreshold` parameter. Only non-negative values are allowed; an exception will be thrown otherwise.- Parameters:
bThreshold- the new threshold value to be assigned. Must be a non-negative number.- Throws:
IllegalArgumentException- if the provided value is negative.
-
setWThreshold
public void setWThreshold(double wThreshold) Sets the threshold value for the `wThreshold` field. This is used to define a specific limit or boundary for the `wThreshold` parameter. Only non-negative values are allowed; an exception will be thrown otherwise.- Parameters:
wThreshold- the new threshold value to be assigned. Must be a non-negative number.
-