Class DiscreteBicScore

java.lang.Object
edu.cmu.tetrad.search.score.DiscreteBicScore
All Implemented Interfaces:
DiscreteScore, Score

public class DiscreteBicScore extends Object implements DiscreteScore
Calculates the discrete BIC score. The likelihood for this score is calculated as SUM(ln(P(X | Z) P(Z)) across all cells in all conditional probability tables for the discrete model. The parameters are counted as SUM(rows * (cols - 1)) for all conditional probability tables in the model. Then the BIC score is calculated as 2L - ck ln N, where c is a multiplier on the penalty ("penalty discount").

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

Author:
josephramsey
  • Constructor Details

    • DiscreteBicScore

      public DiscreteBicScore(DataSet dataSet)
      Constructor.
      Parameters:
      dataSet - The discrete dataset to analyze.
  • Method Details

    • localScore

      public double localScore(int node, int[] parents)
      Returns the score of the given nodes given its parents.
      Specified by:
      localScore in interface Score
      Parameters:
      node - The index of the node.
      parents - The indices of the node's parents.
      Returns:
      The score.
    • localScoreDiff

      public double localScoreDiff(int x, int y, int[] z)
      Returns localScore(y | z, x) - localScore(y | z).
      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - A node.
      y - TAhe node.
      z - A set of nodes.
      Returns:
      This score.
    • getVariables

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

      public void setVariables(List<Node> variables)
      Sets the variables to a new list of the same size.
      Parameters:
      variables - The new list of variables.
    • getSampleSize

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

      public boolean isEffectEdge(double bump)
      Must be called directly after the corresponding scoring call. Used in FGES.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - The score bump.
      Returns:
      True iff the edge between x and y is an effect edge.
      See Also:
    • getDataSet

      public DataSet getDataSet()
      Returns the dataset being analyzed.
      Specified by:
      getDataSet in interface DiscreteScore
      Returns:
      this dataset.
    • setStructurePrior

      public void setStructurePrior(double structurePrior)
      Sets the structure prior.
      Specified by:
      setStructurePrior in interface DiscreteScore
      Parameters:
      structurePrior - This prior.
    • setSamplePrior

      public void setSamplePrior(double samplePrior)
      This method is not used for this score.
      Specified by:
      setSamplePrior in interface DiscreteScore
      Parameters:
      samplePrior - Ibid.
      Throws:
      javax.help.UnsupportedOperationException - Since this method is not used.
    • setPenaltyDiscount

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

      public int getMaxDegree()
      Returns the maximum degree for some algorithms.
      Specified by:
      getMaxDegree in interface Score
      Returns:
      1000.
    • toString

      public String toString()
      Returns a string representation of this score.
      Specified by:
      toString in interface Score
      Overrides:
      toString in class Object
      Returns:
      This string.