Class CpdagParentDistancesFromTrue

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

public class CpdagParentDistancesFromTrue extends Object
CpdagParentDistancesFromTrue computes the distances between true edge strengths in a true DAG and the range of estimated edge strengths in an output CPDAG. The distance is based on the difference between the true edge strength and the range of estimated regression coefficients. The range is determined by considering all possible parent sets for the child node. The distance is 0 if the true edge strength falls within the range of coefficients. If the true edge strength is less than the minimum coefficient, the distance is the absolute value of the difference between the true strength and the minimum coefficient. If the true edge strength is greater than the maximum coefficient, the distance is the absolute value of the difference between the true strength and the maximum coefficient.

This implements a method due to Peter Sprirtes.

Author:
josephramsey
  • Constructor Details

    • CpdagParentDistancesFromTrue

      public CpdagParentDistancesFromTrue()
      Constructs a new instance of the class.
  • Method Details

    • getDistances

      public double[][] getDistances(Graph outputCpdag, double[][] trueEdgeStrengths, DataSet dataSet, CpdagParentDistancesFromTrue.DistanceType distanceType)
      Calculates the distance matrix for the edges in the given CPDAG (outputCpdag). The nodes in the output CPDAG must all be in the full list of nodes given. The distance for each edge u -> v is computed based on how far the true edge strength (from trueEdgeStrengths) is from the estimated regression coefficients for u -> v. The distances are based on the difference between the true edge strength to the range of estimated regression coefficients. The range is determined by considering all possible parent sets for node v. The distance is 0 if the true edge strength falls within the range of coefficients. If the true edge strength is less than the minimum coefficient, the distance is the absolute value of the difference between the true strength and the minimum coefficient. If the true edge strength is greater than the maximum coefficient, the distance is the absolute value of the difference between the true strength and the maximum * coefficient.

      The distance matrix is a square matrix where the entry at row v and column u is the distance for the edge u -> v.

      Parameters:
      outputCpdag - The estimated CPDAG.
      trueEdgeStrengths - The true edge strengths (coefficients) for the true DAG, where trueEdgeStrengths[u][v] is the beta coefficient for u -> v.
      dataSet - The dataset used for regression.
      distanceType - The type of distance to calculate (absolute or squared).
      Returns:
      A matrix of distances between true edge strengths and estimated strengths. Here, dist[u][v] is the distance for the edge u -> v.
    • getMinCoef

      public double[][] getMinCoef()
      Returns the minimum estimated coefficients for each edge.
      Returns:
      The minimum estimated coefficients.
    • getMaxCoef

      public double[][] getMaxCoef()
      Returns the maximum estimated coefficients for each edge.
      Returns:
      The maximum estimated coefficients.