Class BayesImProbs

java.lang.Object
edu.cmu.tetrad.bayes.BayesImProbs
All Implemented Interfaces:
TetradSerializable, Serializable

public final class BayesImProbs extends Object implements TetradSerializable
Calculates cell probabilities from conditional BayesIm probabilities on the fly without constructing the entire table. (To force the entire table to be constructed, use StoredCellProbs.)
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • BayesImProbs

      public BayesImProbs(BayesIm bayesIm)
      Constructs a BayesImProbs object from the given BayesIm.
      Parameters:
      bayesIm - Ibid.
  • Method Details

    • serializableInstance

      public static BayesImProbs serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a simple exemplar of this class to test serialization.
    • getCellProb

      public double getCellProb(int[] variableValues)
      Calculates the probability in the given cell from the conditional probabilities in the BayesIm. It's the product of the probabilities that each variable takes on the value it does given that the other variables take on the values they do in that cell. The returned value will be undefined (Double.NaN) if any of the conditional probabilities being multiplied together is undefined.
      Parameters:
      variableValues - an array of int objects
      Returns:
      the cell probability, or NaN if this probability is undefined.
    • getProb

      public double getProb(Proposition assertion)
      Calculates the probability of a given proposition.
      Parameters:
      assertion - the proposition for which we want to calculate the probability
      Returns:
      the probability of the given proposition
    • getConditionalProb

      public double getConditionalProb(Proposition assertion, Proposition condition)
      Calculates the conditional probability of an assertion given a condition.
      Parameters:
      assertion - the proposition representing the assertion
      condition - the proposition representing the condition
      Returns:
      the conditional probability of the assertion given the condition
      Throws:
      IllegalArgumentException - if the assertion and condition are not for the same Bayes IM
    • getVariables

      public List<Node> getVariables()

      Getter for the field variables.

      Returns:
      a List object