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.

Version:
$Id: $Id
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 local score of a node given its parents.
      Specified by:
      localScore in interface Score
      Parameters:
      node - The node.
      parents - The parents of the node.
      Returns:
      The local score of the node.
    • localScoreDiff

      public double localScoreDiff(int x, int y, int[] z)
      Calculates the difference in local scores between two nodes y and x, when x is added to a set of nodes z.
      Specified by:
      localScoreDiff in interface Score
      Parameters:
      x - A node.
      y - The node.
      z - A set of nodes.
      Returns:
      The difference in local scores between y and x added to z.
    • getVariables

      public List<Node> getVariables()
      Retrieves the list of variables used in the object.
      Specified by:
      getVariables in interface Score
      Returns:
      A list of Node objects representing the variables used.
    • 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)
      Determines whether the bump exceeds zero.
      Specified by:
      isEffectEdge in interface Score
      Parameters:
      bump - The bump value.
      Returns:
      true if the bump is greater than zero, otherwise false.
    • getDataSet

      public DataSet getDataSet()
      Retrieves the dataset associated with this BdeuScore object.
      Specified by:
      getDataSet in interface DiscreteScore
      Returns:
      The dataset.
    • getStructurePrior

      public double getStructurePrior()
      Retrieves the structure prior associated with this BdeuScore object.
      Returns:
      The structure prior.
    • setStructurePrior

      public void setStructurePrior(double structurePrior)
      Sets the structure prior for the BdeuScore object.
      Specified by:
      setStructurePrior in interface DiscreteScore
      Parameters:
      structurePrior - The structure prior to be set.
    • getSamplePrior

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

      public void setSamplePrior(double samplePrior)
      Sets the sample prior for the BdeuScore object.
      Specified by:
      setSamplePrior in interface DiscreteScore
      Parameters:
      samplePrior - The sample prior to be set.
    • toString

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

      public int getMaxDegree()
      Returns the maximum degree of the BDeuScore object.

      The maximum degree is calculated as the ceiling value of the logarithm of the sample size.

      Specified by:
      getMaxDegree in interface Score
      Returns:
      The maximum degree.
    • determines

      public boolean determines(List<Node> z, Node y)
      Determines whether a set of nodes z determines a specific node y.
      Specified by:
      determines in interface Score
      Parameters:
      z - The set of nodes.
      y - The node to be determined.
      Returns:
      true if the set of nodes z determines the node y, false otherwise.
      Throws:
      UnsupportedOperationException - The BDeu score does not implement a 'determines' method.