Class ConditionalGaussianScore

java.lang.Object
edu.cmu.tetrad.search.score.ConditionalGaussianScore
All Implemented Interfaces:
Score

public class ConditionalGaussianScore extends Object implements Score

Implements a conditional Gaussian BIC score for FGS, which calculates a BIC score for mixed discrete/Gaussian data using the conditional Gaussian likelihood function (see). The reference is here:

Andrews, B., Ramsey, J., invalid input: '&' Cooper, G. F. (2018). Scoring Bayesian networks of mixed variables. International journal of data science and analytics, 6, 3-18.

As for all scores in Tetrad, higher scores mean more dependence, and negative scores indicate independence.

* @author josephramsey
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConditionalGaussianScore(DataSet dataSet, double penaltyDiscount, boolean discretize)
    Constructs the score using a covariance matrix.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    This score does not implement a method to decide whether a given set of parents determines a given child, so an exception is thrown.
    int
    Returns the max degree recommended for the search form the MagSemBicScore and Fges.
    double
    Returns the penalty discount for this score, which is a multiplier on the penatly term of the BIC score.
    int
    Reurns the sample size of the data.
    Returns the variables of the data.
    boolean
    isEffectEdge(double bump)
    A method for FGES for determining whether an edge counts as an effect edges for this score bump.
    double
    localScore(int i, int... parents)
    Calculates the sample likelihood and BIC score for i given its parents in a simple SEM model.
    double
    localScoreDiff(int x, int y, int[] z)
    Calculates localScore(y | z, x) - localScore(z).
    void
    setNumCategoriesToDiscretize(int numCategoriesToDiscretize)
    Sets tne number of categories used to discretize, when this optimization is used.
    void
    setPenaltyDiscount(double penaltyDiscount)
    Sets the penalty discount for this score, which is a multiplier on the penalty discount of the BIC score.
    void
    setStructurePrior(double structurePrior)
     
    A string representation of the score.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface edu.cmu.tetrad.search.score.Score

    append, getVariable, localScore, localScore, localScoreDiff
  • Constructor Details

    • ConditionalGaussianScore

      public ConditionalGaussianScore(DataSet dataSet, double penaltyDiscount, boolean discretize)
      Constructs the score using a covariance matrix.
      Parameters:
      dataSet - A dataset with a mixture of continuous and discrete variables. It may be all continuous or all discrete.
      penaltyDiscount - A multiplier on the penalty term in the BIC score.
      discretize - When a discrete variable is a child of a continuous variable, one (expensive) way to solve the problem is to do a numerical integration. A less expensive (and often more accurate) way to solve the problem is to discretize the child with a certian number of discrete categories. if this parameter is set to True, a separate copy of all variables is maintained that is discretized in this way, and these are substituted for the discrete children when this sort of problem needs to be solved. This information needs to be known in the constructor since one needs to know right away whether ot create this separate discretized version of the continuous columns.
      See Also:
  • Method Details

    • localScore

      public double localScore(int i, int... parents)
      Calculates the sample likelihood and BIC score for i given its parents in a simple SEM model.
      Specified by:
      localScore in interface Score
      Parameters:
      i - The index of the child.
      parents - The indices of the parents.
      Returns:
      The score.,
    • localScoreDiff

      public double localScoreDiff(int x, int y, int[] z)
      Calculates localScore(y | z, x) - localScore(z).
      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - The index of the child.
      z - The indices of the parents.
      Returns:
      The score difference.
    • getSampleSize

      public int getSampleSize()
      Reurns the sample size of the data.
      Specified by:
      getSampleSize in interface Score
      Returns:
      This size.
    • isEffectEdge

      public boolean isEffectEdge(double bump)
      A method for FGES for determining whether an edge counts as an effect edges for this score bump.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - The bump in score.
      Returns:
      True iff so.
      See Also:
    • getVariables

      public List<Node> getVariables()
      Returns the variables of the data.
      Specified by:
      getVariables in interface Score
      Returns:
      This list.
    • getMaxDegree

      public int getMaxDegree()
      Returns the max degree recommended for the search form the MagSemBicScore and Fges.
      Specified by:
      getMaxDegree in interface Score
      Returns:
      This max degree.
      See Also:
    • determines

      public boolean determines(List<Node> z, Node y)
      This score does not implement a method to decide whether a given set of parents determines a given child, so an exception is thrown.
      Specified by:
      determines in interface Score
      Throws:
      UnsupportedOperationException - Since this method is not supported.
    • getPenaltyDiscount

      public double getPenaltyDiscount()
      Returns the penalty discount for this score, which is a multiplier on the penatly term of the BIC score.
      Returns:
      This penalty discount.
    • setPenaltyDiscount

      public void setPenaltyDiscount(double penaltyDiscount)
      Sets the penalty discount for this score, which is a multiplier on the penalty discount of the BIC score.
      Parameters:
      penaltyDiscount - This penalty discount.
    • setNumCategoriesToDiscretize

      public void setNumCategoriesToDiscretize(int numCategoriesToDiscretize)
      Sets tne number of categories used to discretize, when this optimization is used.
      Parameters:
      numCategoriesToDiscretize - This number.
    • toString

      public String toString()
      Description copied from interface: Score
      A string representation of the score.
      Specified by:
      toString in interface Score
      Overrides:
      toString in class Object
      Returns:
      This string.
    • setStructurePrior

      public void setStructurePrior(double structurePrior)