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.intGets the maximum degree of the BDe Score.intReturns the sample size of the data set.Returns the variables present in the DataSet associated with this method.booleanisEffectEdge(double bump) Determines if an edge has an effect.doublelocalScore(int i, int[] parents) Returns the score for the given parent given its parents, where these are specified as column indices into the dataset.doublelocalScoreDiff(int x, int y, int[] z) Returns the score difference of the graph.voidsetPriorEquivalentSampleSize(double samplePrior) Sets the sample prior for the BDe score.voidsetStructurePrior(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, waitMethods 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:
localScorein 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:
localScoreDiffin 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:
getDataSetin interfaceDiscreteScore- Returns:
- The DataSet object.
-
setStructurePrior
public void setStructurePrior(double structurePrior) Sets the structure prior for the BDe score.- Specified by:
setStructurePriorin interfaceDiscreteScore- Parameters:
structurePrior- The structure prior value.
-
setPriorEquivalentSampleSize
public void setPriorEquivalentSampleSize(double samplePrior) Sets the sample prior for the BDe score.- Specified by:
setPriorEquivalentSampleSizein interfaceDiscreteScore- Parameters:
samplePrior- The sample prior value.
-
getVariables
Returns the variables present in the DataSet associated with this method.- Specified by:
getVariablesin interfaceScore- Returns:
- A list of Node objects representing the variables.
-
getSampleSize
public int getSampleSize()Returns the sample size of the data set.- Specified by:
getSampleSizein interfaceScore- Returns:
- The sample size.
-
isEffectEdge
public boolean isEffectEdge(double bump) Determines if an edge has an effect.- Specified by:
isEffectEdgein 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:
getMaxDegreein interfaceScore- Returns:
- The maximum degree.
-
toString
Returns a string representation of the object.
-