Package edu.cmu.tetrad.search.score
Class BdeuScore
java.lang.Object
edu.cmu.tetrad.search.score.BdeuScore
- All Implemented Interfaces:
DiscreteScore,Score
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandetermines(List<Node> z, Node y) Determines whether a set of nodes z determines a specific node y.Retrieves the dataset associated with this BdeuScore object.intReturns the maximum degree of the BDeuScore object.doubleReturns the sample prior.intReturns the sample size of the data.doubleRetrieves the structure prior associated with this BdeuScore object.Retrieves the list of variables used in the object.booleanisEffectEdge(double bump) Determines whether the bump exceeds zero.doublelocalScore(int node, int[] parents) Calculates the local score of a node given its parents.doublelocalScoreDiff(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.voidsetSamplePrior(double samplePrior) Sets the sample prior for the BdeuScore object.voidsetStructurePrior(double structurePrior) Sets the structure prior for the BdeuScore object.toString()Returns a string representation of this BDeu Score object.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.cmu.tetrad.search.score.Score
append, getVariable, localScore, localScore, localScoreDiff
-
Constructor Details
-
BdeuScore
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:
localScorein interfaceScore- 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:
localScoreDiffin interfaceScore- 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
Retrieves the list of variables used in the object.- Specified by:
getVariablesin interfaceScore- Returns:
- A list of Node objects representing the variables used.
-
getSampleSize
public int getSampleSize()Returns the sample size of the data.- Specified by:
getSampleSizein interfaceScore- Returns:
- This size.
-
isEffectEdge
public boolean isEffectEdge(double bump) Determines whether the bump exceeds zero.- Specified by:
isEffectEdgein interfaceScore- Parameters:
bump- The bump value.- Returns:
trueif the bump is greater than zero, otherwisefalse.
-
getDataSet
Retrieves the dataset associated with this BdeuScore object.- Specified by:
getDataSetin interfaceDiscreteScore- 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:
setStructurePriorin interfaceDiscreteScore- 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:
setSamplePriorin interfaceDiscreteScore- Parameters:
samplePrior- The sample prior to be set.
-
toString
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:
getMaxDegreein interfaceScore- Returns:
- The maximum degree.
-
determines
Determines whether a set of nodes z determines a specific node y.- Specified by:
determinesin interfaceScore- Parameters:
z- The set of nodes.y- The node to be determined.- Returns:
trueif the set of nodes z determines the node y,falseotherwise.- Throws:
UnsupportedOperationException- The BDeu score does not implement a 'determines' method.
-