Class BdeScore

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

public class BdeScore extends Object implements DiscreteScore
Calculates the BDe score (Bayes Dirichlet Equivalent) score for analyzing discrete multinomial data. A good discussion of BD* scores can be found here:

Heckerman, D., Geiger, D. & Chickering, D.M. Learning Bayesian networks: The combination of knowledge and statistical data. Mach Learn 20, 197–243 (1995).

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

    • BdeScore

      public BdeScore(DataSet dataSet)
      Constructs a BDe score for the given dataset.
      Parameters:
      dataSet - A discrete dataset.
  • Method Details

    • localScore

      public double localScore(int i, int[] parents)
      Returns the score for the given parent given its parents, where these are specified as column indices into the dataset.
      Specified by:
      localScore in interface Score
      Parameters:
      i - The index of the variable.
      parents - The indices of the parents of the variables.
      Returns:
      the score, or NaN if the score can't be calculated.
    • localScoreDiff

      public double localScoreDiff(int x, int y, int[] z)
      Returns the score difference of the graph.

      Returns the difference between localScore(y | z, x) and localScore(y | z)

      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - A node.
      y - TAhe node.
      z - A set of nodes.
      Returns:
      The score difference.
    • getDataSet

      public DataSet getDataSet()
      Returns the DataSet associated with this method.
      Specified by:
      getDataSet in interface DiscreteScore
      Returns:
      The DataSet object.
    • setStructurePrior

      public void setStructurePrior(double structurePrior)
      Sets the structure prior for the BDe score.
      Specified by:
      setStructurePrior in interface DiscreteScore
      Parameters:
      structurePrior - The structure prior value.
    • setSamplePrior

      public void setSamplePrior(double samplePrior)
      Sets the sample prior for the BDe score.
      Specified by:
      setSamplePrior in interface DiscreteScore
      Parameters:
      samplePrior - The sample prior value.
    • getVariables

      public List<Node> getVariables()
      Returns the variables present in the DataSet associated with this method.
      Specified by:
      getVariables in interface Score
      Returns:
      A list of Node objects representing the variables.
    • getSampleSize

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

      public boolean isEffectEdge(double bump)
      Determines if an edge has an effect.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - The bump value.
      Returns:
      true if the bump value is greater than -20, false otherwise.
    • getMaxDegree

      public int getMaxDegree()
      Gets the maximum degree of the BDe Score.
      Specified by:
      getMaxDegree in interface Score
      Returns:
      The maximum degree.
    • toString

      public String toString()
      Returns a string representation of the object.
      Specified by:
      toString in interface Score
      Overrides:
      toString in class Object
      Returns:
      A string representation of the object.