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.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
determines
(List<Node> z, Node y) This score does not implement a method to decide whehter a node is determined by its parents.Returns the dataset being analyzed.int
Returns the needed max degree for some searches.double
Returns the smaple prior.int
Returns the sample size of the data.double
Returns the structure prior.Returns the variables of the data.boolean
isEffectEdge
(double bump) For FGES, this determines whether an edge counts as an effect edge.double
localScore
(int node, int[] parents) Calculates the BDeu score of a node given its parents.double
localScoreDiff
(int x, int y, int[] z) Calculates localScore(y | z, x) - localScore(y | z).void
setSamplePrior
(double samplePrior) Set the sample priorvoid
setStructurePrior
(double structurePrior) Sets the structure priortoString()
Returns a string representation of this score.Methods inherited from class java.lang.Object
clone, equals, finalize, 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 BDeu score of a node given its parents.- Specified by:
localScore
in interfaceScore
- 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 interfaceScore
- Parameters:
x
- The index of x.y
- The index of y.z
- The indeces of the z variables.- Returns:
- The score difference.
-
getVariables
Returns the variables of the data.- Specified by:
getVariables
in interfaceScore
- Returns:
- These variables as a list.
-
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) For FGES, this determines whether an edge counts as an effect edge.- Specified by:
isEffectEdge
in interfaceScore
- Parameters:
bump
- The bump for the edge.- Returns:
- True, if so.
- See Also:
-
getDataSet
Returns the dataset being analyzed.- Specified by:
getDataSet
in interfaceDiscreteScore
- 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 interfaceDiscreteScore
- 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 interfaceDiscreteScore
- Parameters:
samplePrior
- This prior.
-
toString
Returns a string representation of this score. -
getMaxDegree
public int getMaxDegree()Returns the needed max degree for some searches.- Specified by:
getMaxDegree
in interfaceScore
- Returns:
- This max degree.
-
determines
This score does not implement a method to decide whehter a node is determined by its parents.- Specified by:
determines
in interfaceScore
- Parameters:
z
- The parents.y
- The node.- Returns:
- This determination
- Throws:
UnsupportedOperationException
- Since this method not implemented for this core.
-