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 TypeMethodDescriptionboolean
determines
(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.int
Returns the maximum degree of the BDeuScore object.double
Returns the sample prior.int
Returns the sample size of the data.double
Retrieves the structure prior associated with this BdeuScore object.Retrieves the list of variables used in the object.boolean
isEffectEdge
(double bump) Determines whether the bump exceeds zero.double
localScore
(int node, int[] parents) Calculates the local score of a node given its parents.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.void
setSamplePrior
(double samplePrior) Sets the sample prior for the BdeuScore object.void
setStructurePrior
(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, wait
Methods 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:
localScore
in 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:
localScoreDiff
in 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:
getVariables
in interfaceScore
- 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 interfaceScore
- Returns:
- This size.
-
isEffectEdge
public boolean isEffectEdge(double bump) Determines whether the bump exceeds zero.- Specified by:
isEffectEdge
in interfaceScore
- Parameters:
bump
- The bump value.- Returns:
true
if the bump is greater than zero, otherwisefalse
.
-
getDataSet
Retrieves the dataset associated with this BdeuScore object.- Specified by:
getDataSet
in 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:
setStructurePrior
in 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:
setSamplePrior
in interfaceDiscreteScore
- Parameters:
samplePrior
- The sample prior to be set.
-
toString
-
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 interfaceScore
- Returns:
- The maximum degree.
-
determines
Determines whether a set of nodes z determines a specific node y.- Specified by:
determines
in interfaceScore
- 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.
-