Class IcaLingD

java.lang.Object
edu.cmu.tetrad.search.IcaLingD

public class IcaLingD extends Object
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
    Constructor
    Description
    Default constructor for the IcaLingD class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Matrix
    estimateW(DataSet data, int fastIcaMaxIter, double fastIcaTolerance, double fastIcaA)
    Estimates the weight matrix W using the Fast Independent Component Analysis (FastICA) algorithm.
    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.
    Convenience: estimate W via FastICA, then enumerate B̂ candidates.
    static Matrix
    Build B̂ from a permutation result; robust to tiny diagonals.
    Local LiNG-D from a given W: 1) Threshold W (small entries -> 0).
    static boolean
    Spectral-radius stability with small tolerance.
    static @NotNull Graph
    makeGraph(Matrix B, List<Node> variables)
    Constructs a directed graph based on the input binary adjacency matrix and a list of nodes.
    Computes a permutation matrix pair that maximizes the diagonal elements of a given matrix W.
    static Matrix
    Scale columns by their diagonal (guarding tiny/zero).
    void
    setBThreshold(double bThreshold)
    Sets the threshold value for the `bThreshold` field.
    void
    setWThreshold(double wThreshold)
    Sets the threshold value for the `wThreshold` field.
    static Matrix
    threshold(Matrix M, double threshold)
    Hard threshold (copy).

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 process
      fastIcaMaxIter - the maximum number of iterations for the FastICA algorithm
      fastIcaTolerance - the convergence tolerance for the FastICA algorithm
      fastIcaA - 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 process
      fastIcaMaxIter - the maximum number of iterations for the FastICA algorithm
      fastIcaTolerance - the convergence tolerance threshold for the FastICA algorithm
      fastIcaA - the scaling parameter alpha used in the FastICA nonlinearity function
      verbose - 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

      @NotNull public static @NotNull Graph makeGraph(Matrix B, List<Node> variables)
      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 graph
      variables - the list of nodes corresponding to the graph's variables
      Returns:
      the constructed directed graph
    • maximizeDiagonal

      public static PermutationMatrixPair maximizeDiagonal(Matrix W)
      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

      public static boolean isStable(Matrix bHat)
      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

      public static Matrix scale(Matrix M)
      Scale columns by their diagonal (guarding tiny/zero).
      Parameters:
      M - the matrix to scale
      Returns:
      the scaled matrix
    • threshold

      public static Matrix threshold(Matrix M, double threshold)
      Hard threshold (copy).
      Parameters:
      M - the matrix to threshold
      threshold - the threshold value
      Returns:
      the thresholded matrix
    • getScaledBHat

      public static Matrix getScaledBHat(PermutationMatrixPair pair)
      Build B̂ from a permutation result; robust to tiny diagonals.
      Parameters:
      pair - the permutation matrix pair
      Returns:
      the scaled B̂ matrix
    • fit

      public List<Matrix> fit(DataSet D)
      Convenience: estimate W via FastICA, then enumerate B̂ candidates.
      Parameters:
      D - the dataset to fit
      Returns:
      the list of scaled B̂ matrices
    • getScaledBHats

      public List<Matrix> getScaledBHats(Matrix W)
      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.