Class BdeMetricCache

java.lang.Object
edu.cmu.tetrad.bayes.BdeMetricCache

public final class BdeMetricCache extends Object

Provides a method for computing the score of a model, called the BDe metric (Bayesian Dirchlet likelihood equivalence), given a dataset (assumes no missing values) and a Bayes parameterized network (assumes no latent variables).> 0

This version has a method that computes the score for a given factor of a model, where a factor is determined by a node and its parents. It stores scores in a map whose argument is an ordered pair consisting of 1) a node and 2) set of parents. The score for the entire model is the product of the scores of its factors. Since the log of the gamma function is used here the sum of the logs is computed as the score. Compare this with the score method in the BdeMetric class which computes the score for the entire model in one pass. The advantage of the approach in this class is that it is more efficient in the context of a search algorithm where different models are scored but where many of them will have the same factors. This class stores the score (relative to the dataset) for any [node, set of parents] pair and thus avoids the expensive log gamma function calls. Instead it looks in the map scores to see if it has already computed the score and, if so, returns the previously computed value.> 0

See "Learning Bayesian Networks: The Combination of Knowledge and Statistical Data" by David Heckerman, Dan Geiger, and David M. Chickering. Microsoft Technical Report MSR-TR-94-09.> 0

Author:
Frank Wimberly
  • Constructor Details

    • BdeMetricCache

      public BdeMetricCache(DataSet dataSet, BayesPm bayesPm)
  • Method Details

    • scoreLnGam

      public double scoreLnGam(Node node, Set<Node> parents, BayesPm bayesPmMod, BayesIm bayesIm)
      Computes the BDe score, using the logarithm of the gamma function, relative to the data, of the factor determined by a node and its parents.
    • getObservedCounts

      public double[][] getObservedCounts(Node node, BayesPm bayesPm, BayesIm bayesIm)
      This method is used in testing and debugging and not in the BDe metric calculations.
    • getScoreCount

      public int getScoreCount(Node node, Set<Node> parents)
      This is just for testing the operation of the inner class and the map from nodes and parent sets to scores.