Package edu.cmu.tetrad.search.score
Class BdeScore
java.lang.Object
edu.cmu.tetrad.search.score.BdeScore
- All Implemented Interfaces:
DiscreteScore
,Score
Calculates the BDe score (Bayes Dirichlet Equivalent) score for analyzing discrete multinomial data. 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 TypeMethodDescriptionReturns the DataSet associated with this method.int
Gets the maximum degree of the BDe Score.int
Returns the sample size of the data set.Returns the variables present in the DataSet associated with this method.boolean
isEffectEdge
(double bump) Determines if an edge has an effect.double
localScore
(int i, int[] parents) Returns the score for the given parent given its parents, where these are specified as column indices into the dataset.double
localScoreDiff
(int x, int y, int[] z) Returns the score difference of the graph.void
setSamplePrior
(double samplePrior) Sets the sample prior for the BDe score.void
setStructurePrior
(double structurePrior) Sets the structure prior for the BDe score.toString()
Returns a string representation of the 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, determines, getVariable, localScore, localScore, localScoreDiff
-
Constructor Details
-
BdeScore
Constructs a BDe score for the given dataset.- Parameters:
dataSet
- A discrete dataset.
-
-
Method Details
-
localScore
public double localScore(int i, int[] parents) Returns the score for the given parent given its parents, where these are specified as column indices into the dataset.- Specified by:
localScore
in interfaceScore
- Parameters:
i
- The index of the variable.parents
- The indices of the parents of the variables.- Returns:
- the score, or NaN if the score can't be calculated.
-
localScoreDiff
public double localScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.Returns the difference between localScore(y | z, x) and localScore(y | z)
- Specified by:
localScoreDiff
in interfaceScore
- Parameters:
x
- A node.y
- TAhe node.z
- A set of nodes.- Returns:
- The score difference.
-
getDataSet
Returns the DataSet associated with this method.- Specified by:
getDataSet
in interfaceDiscreteScore
- Returns:
- The DataSet object.
-
setStructurePrior
public void setStructurePrior(double structurePrior) Sets the structure prior for the BDe score.- Specified by:
setStructurePrior
in interfaceDiscreteScore
- Parameters:
structurePrior
- The structure prior value.
-
setSamplePrior
public void setSamplePrior(double samplePrior) Sets the sample prior for the BDe score.- Specified by:
setSamplePrior
in interfaceDiscreteScore
- Parameters:
samplePrior
- The sample prior value.
-
getVariables
Returns the variables present in the DataSet associated with this method.- Specified by:
getVariables
in interfaceScore
- Returns:
- A list of Node objects representing the variables.
-
getSampleSize
public int getSampleSize()Returns the sample size of the data set.- Specified by:
getSampleSize
in interfaceScore
- Returns:
- The sample size.
-
isEffectEdge
public boolean isEffectEdge(double bump) Determines if an edge has an effect.- Specified by:
isEffectEdge
in interfaceScore
- Parameters:
bump
- The bump value.- Returns:
- true if the bump value is greater than -20, false otherwise.
-
getMaxDegree
public int getMaxDegree()Gets the maximum degree of the BDe Score.- Specified by:
getMaxDegree
in interfaceScore
- Returns:
- The maximum degree.
-
toString
-