Class BdeuScore

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

public class BdeuScore extends Object implements DiscreteScore

Calculates the BDeu score, which the BDe (Bayes Dirichlet Equivalent) score with uniform priors. 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

    • BdeuScore

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

    • localScore

      public double localScore(int node, int[] parents)
      Calculates the BDeu score of a node 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)
      Calculates localScore(y | z, x) - localScore(y | z).
      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - The index of x.
      y - The index of y.
      z - The indeces of the z variables.
      Returns:
      The score difference.
    • getVariables

      public List<Node> getVariables()
      Returns the variables of the data.
      Specified by:
      getVariables in interface Score
      Returns:
      These variables as a 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)
      For FGES, this determines whether an edge counts as an effect edge.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - The bump for the edge.
      Returns:
      True, if so.
      See Also:
    • getDataSet

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

      public double getStructurePrior()
      Returns the structure prior.
      Returns:
      This prior.
    • setStructurePrior

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

      public double getSamplePrior()
      Returns the smaple prior.
      Returns:
      This prior.
    • setSamplePrior

      public void setSamplePrior(double samplePrior)
      Set the sample prior
      Specified by:
      setSamplePrior in interface DiscreteScore
      Parameters:
      samplePrior - This prior.
    • 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.
    • getMaxDegree

      public int getMaxDegree()
      Returns the needed max degree for some searches.
      Specified by:
      getMaxDegree in interface Score
      Returns:
      This max degree.
    • determines

      public boolean determines(List<Node> z, Node y)
      This score does not implement a method to decide whehter a node is determined by its parents.
      Specified by:
      determines in interface Score
      Parameters:
      z - The parents.
      y - The node.
      Returns:
      This determination
      Throws:
      UnsupportedOperationException - Since this method not implemented for this core.