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.

Reference: Andrews, B., Ramsey, J., & 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.

Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • ConditionalGaussianScore

      public ConditionalGaussianScore(DataSet dataSet, double penaltyDiscount, boolean discretize)
      Constructs the score.
      Parameters:
      dataSet - mixed (or all-continuous / all-discrete) dataset
      penaltyDiscount - BIC penalty multiplier
      discretize - if true, use shadow discretization of continuous parents for discrete children
  • Method Details

    • localScore

      public double localScore(int i, int... parents)
      Local BIC score for child i with parents.
      Specified by:
      localScore in interface Score
      Parameters:
      i - child index
      parents - parent indices
      Returns:
      local BIC score for child i with parents
    • localScoreDiff

      public double localScoreDiff(int x, int y, int[] z)
      Score difference localScore(y | z ∪ {x}) - localScore(y | z).
      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - index of the variable to add to the parents
      y - index of the child variable
      z - array of parent indices
      Returns:
      score difference
    • getSampleSize

      public int getSampleSize()
      Sample size.
      Specified by:
      getSampleSize in interface Score
      Returns:
      sample size
    • isEffectEdge

      public boolean isEffectEdge(double bump)
      FGES “effect edge” convention for this score bump.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - score bump
      Returns:
      true if the score bump is positive, false otherwise
    • getVariables

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

      public int getMaxDegree()
      Recommended max degree (same heuristic used elsewhere).
      Specified by:
      getMaxDegree in interface Score
      Returns:
      the max degree.
    • getPenaltyDiscount

      public double getPenaltyDiscount()
      Retrieves the penalty discount value used in the scoring calculations.
      Returns:
      the penalty discount value as a double.
    • setPenaltyDiscount

      public void setPenaltyDiscount(double penaltyDiscount)
      Updates the penalty discount value used in the scoring calculations.
      Parameters:
      penaltyDiscount - the new penalty discount value as a double
    • setNumCategoriesToDiscretize

      public void setNumCategoriesToDiscretize(int numCategoriesToDiscretize)
      Sets the number of categories to be used for discretizing child variables in order to avoid integration.
      Parameters:
      numCategoriesToDiscretize - the number of categories to discretize child variables
    • setDiscretize

      public void setDiscretize(boolean discretize)
      Sets whether to discretize child variables for shadow discretization. This affects scoring during the learning process to optimize calculations involving mixed data types.
      Parameters:
      discretize - A boolean value indicating whether to enable discretization. If true, enables discretization.
    • setMinSampleSizePerCell

      public void setMinSampleSizePerCell(int n)
      Sets the minimum sample size per cell for scoring calculations during the learning process.
      Parameters:
      n - The minimum number of samples required per cell to guarantee stable computations.
    • setStructurePrior

      public void setStructurePrior(double structurePrior)
      Sets the structure prior value for the scoring process.
      Parameters:
      structurePrior - The value of the structure prior to be used in scoring calculations.
    • toString

      public String toString()
      Returns a string representation of the Conditional Gaussian Score Penalty. The representation includes the penalty discount formatted to two decimal places.
      Specified by:
      toString in interface Score
      Overrides:
      toString in class Object
      Returns:
      a string describing the Conditional Gaussian Score Penalty and its penalty discount value.