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
      invalid reference
      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)
      Calculates the probability of a given proposition in the context of this object.
      Parameters:
      assertion - a Proposition representing the proposition for which the probability is calculated
      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 in the context of the Bayes IM.
      Parameters:
      assertion - a Proposition object representing the assertion
      condition - a Proposition object 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
      invalid reference
      int
      objects
    • setCellProbability

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

      setCellProbability.

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