Class StoredCellProbsObs

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

public final class StoredCellProbsObs extends Object implements TetradSerializable

Creates a table of stored cell probabilities for the given list of variables. Since for a moderate number of variables and for a moderate number of values per variables this could get to be a very large table, it might not be a good idea to use this class except for unit testing.> 0

Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • StoredCellProbsObs

      public StoredCellProbsObs(List<Node> variables)

      Constructor for StoredCellProbsObs.

      Parameters:
      variables - a List object
  • Method Details

    • serializableInstance

      public static StoredCellProbsObs serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a StoredCellProbsObs object
    • clearCellTable

      public void clearCellTable()

      clearCellTable.

    • createCellTable

      public void createCellTable(MlBayesIm bayesIm)

      createCellTable.

      Parameters:
      bayesIm - a MlBayesIm object
    • createCellTable

      public void createCellTable(MlBayesImObs bayesIm)

      createCellTable.

      Parameters:
      bayesIm - a MlBayesImObs object
    • getCellProb

      public double getCellProb(int[] variableValues)

      getCellProb.

      Parameters:
      variableValues - an array of int objects
      Returns:
      the probability for the given cell, specified as a particular combination of variable values, for the list of variables (in order) returned by get
    • getProb

      public double getProb(Proposition assertion)

      getProb.

      Parameters:
      assertion - a Proposition object
      Returns:
      a double
    • 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
    • getNumRows

      public int getNumRows()

      getNumRows.

      Returns:
      a int
    • toString

      public String toString()

      toString.

      Overrides:
      toString in class Object
      Returns:
      a String object
    • getVariableValues

      public int[] getVariableValues(int rowIndex)

      getVariableValues.

      Parameters:
      rowIndex - a int
      Returns:
      an array of int objects
    • setCellProbability

      public void setCellProbability(int[] variableValues, double probability)

      setCellProbability.

      Parameters:
      variableValues - an array of int objects
      probability - a double