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.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the dataset being analyzed.int
Returns the maximum degree of the graphs as they're searched.int
Returns the sample size of the data.Returns the variables of the dataset.boolean
isEffectEdge
(double bump) Returns a judgment of whether the given bump in score allows one to conclude that the edge is an "effect edge" for FGES.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 different between localScore(y | z, x) and localScore(y | z)void
setSamplePrior
(double samplePrior) BDe does not use a sample prior.void
setStructurePrior
(double structurePrior) BDe does not use a structure prior.toString()
Returns "BDe 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, 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 different between localScore(y | z, x) and localScore(y | z)- Specified by:
localScoreDiff
in interfaceScore
- Parameters:
x
- The index of the x variabley
- The index of the y variable.z
- The indices of the z variables- Returns:
- The differnece in scores.
-
getDataSet
Returns the dataset being analyzed.- Specified by:
getDataSet
in interfaceDiscreteScore
- Returns:
- This dataset.
-
setStructurePrior
public void setStructurePrior(double structurePrior) BDe does not use a structure prior.- Specified by:
setStructurePrior
in interfaceDiscreteScore
- Parameters:
structurePrior
- The structure prior (not used).- Throws:
UnsupportedOperationException
- Since this method is not implemented for this score.
-
setSamplePrior
public void setSamplePrior(double samplePrior) BDe does not use a sample prior.- Specified by:
setSamplePrior
in interfaceDiscreteScore
- Parameters:
samplePrior
- The structure prior (not used).- Throws:
UnsupportedOperationException
- Since this method is not implemented for this score.
-
getVariables
Returns the variables of the dataset.- Specified by:
getVariables
in interfaceScore
- Returns:
- These variables as 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) Returns a judgment of whether the given bump in score allows one to conclude that the edge is an "effect edge" for FGES.- Specified by:
isEffectEdge
in interfaceScore
- Parameters:
bump
- The bump.- Returns:
- True iff so.
- See Also:
-
getMaxDegree
public int getMaxDegree()Returns the maximum degree of the graphs as they're searched.- Specified by:
getMaxDegree
in interfaceScore
- Returns:
- This maximum degree.
-
toString
Returns "BDe Score".
-