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.

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 different between localScore(y | z, x) and localScore(y | z)
      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - The index of the x variable
      y - The index of the y variable.
      z - The indices of the z variables
      Returns:
      The differnece in scores.
    • getDataSet

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

      public void setStructurePrior(double structurePrior)
      BDe does not use a structure prior.
      Specified by:
      setStructurePrior in interface DiscreteScore
      Parameters:
      structurePrior - The structure prior (not used).
      Throws:
      UnsupportedOperationException - Since this method is not implemented for this score.
    • setSamplePrior

      public void setSamplePrior(double samplePrior)
      BDe does not use a sample prior.
      Specified by:
      setSamplePrior in interface DiscreteScore
      Parameters:
      samplePrior - The structure prior (not used).
      Throws:
      UnsupportedOperationException - Since this method is not implemented for this score.
    • getVariables

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

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

      public boolean isEffectEdge(double bump)
      Returns a judgment of whether the given bump in score allows one to conclude that the edge is an "effect edge" for FGES.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - The bump.
      Returns:
      True iff so.
      See Also:
    • getMaxDegree

      public int getMaxDegree()
      Returns the maximum degree of the graphs as they're searched.
      Specified by:
      getMaxDegree in interface Score
      Returns:
      This maximum degree.
    • toString

      public String toString()
      Returns "BDe Score".
      Specified by:
      toString in interface Score
      Overrides:
      toString in class Object
      Returns:
      This string.